]> granicus.if.org Git - php/commitdiff
MFH: fix shmop_open() with IPC_CREAT|IPC_EXCL flags on win32
authorAntony Dovgal <tony2001@php.net>
Tue, 20 Mar 2007 17:57:59 +0000 (17:57 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 20 Mar 2007 17:57:59 +0000 (17:57 +0000)
TSRM/tsrm_win32.c

index b60be0cc9cb5f3d505aaa4458a757103413f785f..5a8983b5e45ac3210f519c2a61f7b7811e984886 100644 (file)
@@ -280,9 +280,6 @@ TSRM_API int shmget(int key, int size, int flags)
        info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
 
        if ((!shm_handle && !info_handle)) {
-               if (flags & IPC_EXCL) {
-                       return -1;
-               }
                if (flags & IPC_CREAT) {
                        shm_handle      = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, shm_segment);
                        info_handle     = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
@@ -291,6 +288,10 @@ TSRM_API int shmget(int key, int size, int flags)
                if ((!shm_handle || !info_handle)) {
                        return -1;
                }
+       } else {
+               if (flags & IPC_EXCL) {
+                       return -1;
+               }
        }
 
        shm = shm_get(key, NULL);