[Openvpn-devel,XS] Change in openvpn[master]: platform.c: Do not depend Windows build on HAVE_CHDIR

Message ID a1c2ca01febfd77959187552a44476064a15a659-HTML@gerrit.openvpn.net
State Superseded
Headers show
Series [Openvpn-devel,XS] Change in openvpn[master]: platform.c: Do not depend Windows build on HAVE_CHDIR | expand

Commit Message

reynir (Code Review) Nov. 10, 2023, 5:38 p.m. UTC
Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/425?usp=email

to review the following change.


Change subject: platform.c: Do not depend Windows build on HAVE_CHDIR
......................................................................

platform.c: Do not depend Windows build on HAVE_CHDIR

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.

Change-Id: I0c78ce452135fe2c80275da449215ba926471018
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
---
M src/openvpn/platform.c
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/425/1

Patch

diff --git a/src/openvpn/platform.c b/src/openvpn/platform.c
index 32c4fe6..62acabe 100644
--- a/src/openvpn/platform.c
+++ b/src/openvpn/platform.c
@@ -392,7 +392,6 @@ 
 int
 platform_chdir(const char *dir)
 {
-#ifdef HAVE_CHDIR
 #ifdef _WIN32
     int res;
     struct gc_arena gc = gc_new();
@@ -400,11 +399,12 @@ 
     gc_free(&gc);
     return res;
 #else  /* ifdef _WIN32 */
+#ifdef HAVE_CHDIR
     return chdir(dir);
-#endif
 #else  /* ifdef HAVE_CHDIR */
     return -1;
 #endif
+#endif
 }
 
 /*