[Openvpn-devel,v1] config.h: fix incorrect defines for _wopen()

Message ID 20231114141653.10486-1-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel,v1] config.h: fix incorrect defines for _wopen() | expand

Commit Message

Gert Doering Nov. 14, 2023, 2:16 p.m. UTC
From: Lev Stipakov <lev@openvpn.net>

This is a regression from commit

  01341840 ("add basic CMake based build")

S_IRUSR and S_IWUSR should NOT be defined as 0 but
as _S_IREAD and _S_IWRITE, as it was already fixed in commit

  077445d0 ("Fix some more wrong defines in config-msvc.h")

Those are used as permission mode when opening a file. Passing
zero makes file read-only, which break for example --status-file
functionality.

Github: fixes OpenVPN/openvpn#454
Trac: #1430

Change-Id: I53eaee85d7b284af6bc63da5f6d8f310ddd96c47
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/429
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering Nov. 14, 2023, 3:07 p.m. UTC | #1
I've not actually tested it, but since we had to fix this once before,
it's "obviously correct".  Also Lev understands Windows :-)

Your patch has been applied to the master and release/2.6 branch.

commit 2fcfb77a8111cce9308bb893f52ecdb77de91e7c (master)
commit 0c174e4e7b6caa1111fbf4773acdfbbcf122489d (release/2.6)
Author: Lev Stipakov
Date:   Tue Nov 14 15:16:53 2023 +0100

     config.h: fix incorrect defines for _wopen()

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20231114141653.10486-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27393.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/config.h.cmake.in b/config.h.cmake.in
index f2cdd39..1c0dd6f 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -469,8 +469,8 @@ 
 #define strncasecmp strnicmp
 #define strcasecmp _stricmp
 
-#define S_IRUSR 0
-#define S_IWUSR 0
+#define S_IRUSR _S_IREAD
+#define S_IWUSR _S_IWRITE
 #define R_OK 4
 #define W_OK 2
 #define X_OK 1