]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
platform.c: Do not depend Windows build on HAVE_CHDIR
authorFrank Lichtenheld <frank@lichtenheld.com>
Sat, 11 Nov 2023 08:18:08 +0000 (09:18 +0100)
committerGert Doering <gert@greenie.muc.de>
Sat, 11 Nov 2023 08:25:04 +0000 (09:25 +0100)
This broke in the CMake build since previously we
just always set HAVE_CHDIR to 1 in the MSVC build.
But actually the code should just not check HAVE_CHDIR
on Windows.

Github: fixes OpenVPN/openvpn#448

Change-Id: I0c78ce452135fe2c80275da449215ba926471018
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20231111081808.30967-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27362.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/platform.c

index 32c4fe6be054f5d2a744c0f3a60b970491604504..62acabe228dff877d1b56c88d813a8dfc6246026 100644 (file)
@@ -392,7 +392,6 @@ platform_mlockall(bool print_msg)
 int
 platform_chdir(const char *dir)
 {
-#ifdef HAVE_CHDIR
 #ifdef _WIN32
     int res;
     struct gc_arena gc = gc_new();
@@ -400,11 +399,12 @@ platform_chdir(const char *dir)
     gc_free(&gc);
     return res;
 #else  /* ifdef _WIN32 */
+#ifdef HAVE_CHDIR
     return chdir(dir);
-#endif
 #else  /* ifdef HAVE_CHDIR */
     return -1;
 #endif
+#endif
 }
 
 /*