From d218e5b03f2c87f5aa1b4ab9c387723482bb6752 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Sun, 27 Nov 2016 17:10:00 +0100 Subject: [PATCH] Replace 0600 in shmget(2) call with symbolic constants. Inspired by Rich Alderson's MacOS 10.6.8 changes. He used IPC_CREAT+IPC_PRIVATE+IPC_R+IPC_W. However, IPC_PRIVATE is a special value for the key argument, not shmflg. Furthermore, adding IPC_CREAT to the flags when the key is IPC_PRIVATE seems unnecessary but should not harm. See http://pubs.opengroup.org/onlinepubs/9699919799/functions/shmget.html for the "IEEE Std 1003.1-2008, 2016 Edition" version of shmget(2). --- src/osdsup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osdsup.c b/src/osdsup.c index 9d2ca13..b2dd793 100644 --- a/src/osdsup.c +++ b/src/osdsup.c @@ -1620,7 +1620,7 @@ os_mmcreate(register size_t memsiz, ** Note shmget will lose grossly if on a system where its size arg ** (defined as a u_int) is less than 32 bits! */ - if ((shmid = shmget(IPC_PRIVATE, (u_int)memsiz, 0600)) == -1) { + if ((shmid = shmget(IPC_PRIVATE, (u_int)memsiz, IPC_CREAT|IPC_R|IPC_W)) == -1) { fprintf(stderr, "[os_mmcreate: shmget failed for %ld bytes - %s]\n", (long)memsiz, os_strerror(errno)); return FALSE;