1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

check validity of specified config

* I accidentially used wrong args when testing conky -> segfault
* reproduce using 'conky -c /this/doesnt/exist'
* code should be portable, but untested on freebsd


git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1044 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Phil 2008-03-24 19:24:55 +00:00
parent c2c01423a8
commit d6953f4864

View File

@ -8500,6 +8500,17 @@ int main(int argc, char **argv)
init_X11(); init_X11();
#endif /* X11 */ #endif /* X11 */
/* check if specified config file is valid */
if (current_config) {
struct stat sb;
if (stat(current_config, &sb) ||
(!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))) {
ERR("invalid configuration file '%s'\n", current_config);
free(current_config);
current_config = 0;
}
}
/* load current_config, CONFIG_FILE or SYSTEM_CONFIG_FILE */ /* load current_config, CONFIG_FILE or SYSTEM_CONFIG_FILE */
if (!current_config) { if (!current_config) {