@@ -150,6 +150,7 @@
check_symbol_exists(ftruncate unistd.h HAVE_FTRUNCATE)
check_symbol_exists(setgid unistd.h HAVE_SETGID)
check_symbol_exists(setuid unistd.h HAVE_SETUID)
+check_symbol_exists(setsid unistd.h HAVE_SETSID)
check_symbol_exists(getpeereid unistd.h HAVE_GETPEEREID)
check_symbol_exists(epoll_create sys/epoll.h HAVE_EPOLL_CREATE)
@@ -218,7 +218,7 @@
#undef HAVE_NICE
/* Define to 1 if you have the `openlog' function. */
-#undef HAVE_OPENLOG
+#cmakedefine HAVE_OPENLOG
/* OpenSSL engine support available */
#undef HAVE_OPENSSL_ENGINE
@@ -258,7 +258,7 @@
#undef HAVE_SETGROUPS
/* Define to 1 if you have the `setsid' function. */
-#undef HAVE_SETSID
+#cmakedefine HAVE_SETSID
/* Define to 1 if you have the `setsockopt' function. */
#define HAVE_SETSOCKOPT 1
@@ -303,7 +303,7 @@
#undef HAVE_STRSEP
/* Define to 1 if you have the `syslog' function. */
-#undef HAVE_SYSLOG
+#cmakedefine HAVE_SYSLOG
/* Define to 1 if you have the <syslog.h> header file. */
#cmakedefine HAVE_SYSLOG_H
@@ -70,7 +70,10 @@
if (!nochdir)
{
- chdir("/");
+ if (chdir("/") == -1)
+ {
+ return (-1);
+ }
}
if (!noclose)
Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/341?usp=email to review the following change. Change subject: CMake: fix broken daemonization and syslog functionality ...................................................................... CMake: fix broken daemonization and syslog functionality While CMake is not the official way to build OpenVPN on Linux, it still make sense to support it. Turns out that HAVE_SETSID, HAVE_OPENLOG and HAVE_SYSLOG were not set by CMake configure, and --daemon and syslog functionality was broken. While on it, fix compiler error on unused return value of chdir(). Change-Id: I171d55da2be868d961caa1d4491e6f1ed10ebe8a Signed-off-by: Lev Stipakov <lev@openvpn.net> --- M CMakeLists.txt M config.h.cmake.in M src/compat/compat-daemon.c 3 files changed, 8 insertions(+), 4 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/341/1