summaryrefslogtreecommitdiffstats
path: root/testing/motion/get_current_dir_name.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/motion/get_current_dir_name.patch')
-rw-r--r--testing/motion/get_current_dir_name.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/motion/get_current_dir_name.patch b/testing/motion/get_current_dir_name.patch
new file mode 100644
index 000000000..d7e3816c2
--- /dev/null
+++ b/testing/motion/get_current_dir_name.patch
@@ -0,0 +1,46 @@
+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 */