This is an automated email from the ASF dual-hosted git repository.

rjung pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-connectors.git


The following commit(s) were added to refs/heads/main by this push:
     new d55706e92 Improve shared memory handling on non-Windows.
d55706e92 is described below

commit d55706e92b65018c2e4c7ab14014a996b0174966
Author: Rainer Jung <rainer.j...@kippdata.de>
AuthorDate: Thu Aug 8 10:00:13 2024 +0200

    Improve shared memory handling on non-Windows.
---
 native/common/jk_shm.c            | 12 ++++++------
 xdocs/miscellaneous/changelog.xml |  3 +++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/native/common/jk_shm.c b/native/common/jk_shm.c
index 857a17ac4..870f8418c 100644
--- a/native/common/jk_shm.c
+++ b/native/common/jk_shm.c
@@ -451,7 +451,7 @@ static int do_shm_open_lock(const char *fname, int 
attached, jk_log_context_t *l
 
     if (attached && jk_shmem.lockname) {
 #ifdef JK_SHM_LOCK_REOPEN
-        jk_shmem.fd_lock = open(jk_shmem.lockname, O_RDWR, 0666);
+        jk_shmem.fd_lock = open(jk_shmem.lockname, O_RDWR, 0600);
 #else
         errno = EINVAL;
 #endif
@@ -475,7 +475,7 @@ static int do_shm_open_lock(const char *fname, int 
attached, jk_log_context_t *l
         for (i = 0; i < 8; i++) {
             strcpy(flkname, "/tmp/jkshmlock.XXXXXX");
             if (mktemp(flkname)) {
-                jk_shmem.fd_lock = open(flkname, O_RDWR|O_CREAT|O_TRUNC, 0666);
+                jk_shmem.fd_lock = open(flkname, O_RDWR|O_CREAT|O_TRUNC, 0600);
                 if (jk_shmem.fd_lock >= 0)
                     break;
             }
@@ -487,10 +487,10 @@ static int do_shm_open_lock(const char *fname, int 
attached, jk_log_context_t *l
 #ifdef AS400_UTF8
         wptr = (char *)malloc(strlen(flkname) + 1);
         jk_ascii2ebcdic((char *)flkname, wptr);
-        jk_shmem.fd_lock = open(wptr, O_RDWR|O_CREAT|O_TRUNC, 0666);
+        jk_shmem.fd_lock = open(wptr, O_RDWR|O_CREAT|O_TRUNC, 0600);
         free(wptr);
 #else
-        jk_shmem.fd_lock = open(flkname, O_RDWR|O_CREAT|O_TRUNC, 0666);
+        jk_shmem.fd_lock = open(flkname, O_RDWR|O_CREAT|O_TRUNC, 0600);
 #endif
 #endif
         if (jk_shmem.fd_lock == -1) {
@@ -581,10 +581,10 @@ static int do_shm_open(const char *fname, int attached,
 #ifdef AS400_UTF8
         wptr = (char *)malloc(strlen(jk_shmem.filename) + 1);
         jk_ascii2ebcdic((char *)jk_shmem.filename, wptr);
-        fd = open(wptr, O_RDWR|O_CREAT|O_TRUNC, 0666);
+        fd = open(wptr, O_RDWR|O_CREAT|O_TRUNC, 0600);
         free(wptr);
 #else
-        fd = open(jk_shmem.filename, O_RDWR|O_CREAT|O_TRUNC, 0666);
+        fd = open(jk_shmem.filename, O_RDWR|O_CREAT|O_TRUNC, 0600);
 #endif
         if (fd == -1) {
             jk_shmem.size = 0;
diff --git a/xdocs/miscellaneous/changelog.xml 
b/xdocs/miscellaneous/changelog.xml
index 8e64986aa..026ea6023 100644
--- a/xdocs/miscellaneous/changelog.xml
+++ b/xdocs/miscellaneous/changelog.xml
@@ -58,6 +58,9 @@
         to reduce symbol visibility. Also improve escaping of it in the 
Makefile.
         Patch provided by lzs...@freemail.c3.hu. (rjung)
       </fix>
+      <fix>
+        Improve shared memory handling on non-Windows. (rjung)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="IIS">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to