From: "cron2 (Code Review)" Date: Wed, 20 Sep 2023 20:36:01 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="1FLuw8ZrhzA="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: CMake: fix broken daemonization and syslog functionality List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa , plaisthos , flichtenheld Cc: openvpn-devel --1FLuw8ZrhzA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= stipa. ( http://gerrit.openvpn.net/c/openvpn/+/341?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by flichtenheld, Code-Review+2 by plaisthos 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 Acked-by: Arne Schwabe Acked-by: Frank Lichtenheld Message-Id: <20230920121519.177949-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27= 045.html Signed-off-by: Gert Doering --- 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/2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dae665..9de6aba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/config.h.cmake.in b/config.h.cmake.in index 4f28917..f2cdd39 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -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 header file. */ #cmakedefine HAVE_SYSLOG_H diff --git a/src/compat/compat-daemon.c b/src/compat/compat-daemon.c index aebb8f4..5c6d740 100644 --- a/src/compat/compat-daemon.c +++ b/src/compat/compat-daemon.c @@ -70,7 +70,10 @@ if (!nochdir) { - chdir("/"); + if (chdir("/") =3D=3D -1) + { + return (-1); + } } =20 if (!noclose) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/341?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I171d55da2be868d961caa1d4491e6f1ed10ebe8a Gerrit-Change-Number: 341 Gerrit-PatchSet: 2 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --1FLuw8ZrhzA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #2 to the change originally cr= eated by stipa.

View Change

The following approvals got outdated and= were removed: Code-Review+2 by flichtenheld, Code-Review+2 by plaisthos

CMake: fix broken=
 daemonization and syslog functionality

While CMake is not the offic= ial way to build OpenVPN on Linux,
it still make sense to support it. Tu= rns out that

HAVE_SETSID, HAVE_OPENLOG and HAVE_SYSLOG

were= not set by CMake configure, and --daemon and syslog
functionality was b= roken.

While on it, fix compiler error on unused return value of chd= ir().

Change-Id: I171d55da2be868d961caa1d4491e6f1ed10ebe8a
Signed= -off-by: Lev Stipakov <lev@...515...>
Acked-by: Arne Schwabe <a= rne-openvpn@...1227...>
Acked-by: Frank Lichtenheld <frank@...2746...= ...>
Message-Id: <20230920121519.177949-1-frank@...2641...>
= URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27= 045.html
Signed-off-by: Gert Doering <gert@...1296...>
---
M= CMakeLists.txt
M config.h.cmake.in
M src/compat/compat-daemon.c
3= files changed, 8 insertions(+), 4 deletions(-)

git pull ssh://ge=
rrit.openvpn.net:29418/openvpn refs/changes/41/341/2
diff --git a/C=
MakeLists.txt b/CMakeLists.txt
index 7dae665..9de6aba 10064= 4
--- a/CMakeLists.txt
+++ b/CMakeLists.txt=
@@ -150,6 +150,7 @@
check_symbol_exists(f= truncate unistd.h HAVE_FTRUNCATE)
check_symbol_exists(setg= id unistd.h HAVE_SETGID)
check_symbol_exists(setuid unistd= .h HAVE_SETUID)
+chec= k_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)<= br>diff --git a/config.h.cmake.in b/config.h.cmake.in
index 4f28917..f2cdd39 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -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 y= ou 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
diff --git a/src/comp= at/compat-daemon.c b/src/compat/compat-daemon.c
index aebb8= f4..5c6d740 100644
--- a/src/compat/compat-daemon.c<= br>+++ b/src/compat/compat-daemon.c
@@ -70,7 +70,10 @= @

if (!nochdir)
= {
- chdir("= ;/");
+ i= f (chdir("/") =3D=3D -1)
+ {
+ return (-1);
+ }
}

if (!noclose)

To view, visit change 341. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I171d55da2be868d961caa1d4491= e6f1ed10ebe8a
Gerrit-Change-Number: 341
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--1FLuw8ZrhzA=--