The check for get_current_dir_name appears to be broken. you need set _GNU_SOURCE for it. But that triggered other issue with broken ifdefs so we simply avoid using get_current_dir_name alltogether. --- ./conf.c.orig +++ ./conf.c @@ -32,16 +32,6 @@ #include "video.h" #endif /* BSD */ -#ifndef HAVE_GET_CURRENT_DIR_NAME -char *get_current_dir_name(void) -{ - char *buf = malloc(MAXPATHLEN); - getwd(buf); - return buf; -} -#endif - - #define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0;} @@ -1645,18 +1635,17 @@ } if (!fp) { /* Commandline didn't work, try current dir */ - char *path = NULL; + char path[PATH_MAX]; if (cnt[0]->conf_filename[0]) motion_log(-1, 1, "Configfile %s not found - trying defaults.", filename); - if ((path = get_current_dir_name()) == NULL) { + if (getcwd(path, PATH_MAX) == NULL) { motion_log(LOG_ERR, 1, "Error get_current_dir_name"); exit(-1); } snprintf(filename, PATH_MAX, "%s/motion.conf", path); fp = fopen (filename, "r"); - free(path); } if (!fp) { /* specified file does not exist... try default file */