commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r819178 - /commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c
Date Sat, 26 Sep 2009 17:08:43 GMT
Author: mturk
Date: Sat Sep 26 17:08:43 2009
New Revision: 819178

URL: http://svn.apache.org/viewvc?rev=819178&view=rev
Log:
Use the same common code

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c?rev=819178&r1=819177&r2=819178&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c Sat Sep 26 17:08:43 2009
@@ -361,11 +361,13 @@
     if (IS_INVALID_HANDLE(m)) {
         return ACR_EBADF;
     }
-    buf.sem_perm.uid  = uid;
-    buf.sem_perm.gid  = gid;
-    buf.sem_perm.mode = ACR_UnixPermsToMode(perms);
     ick.buf = &buf;
-
+    if (semctl(m->filedes, 0, IPC_STAT, ick) < 0) {
+        return ACR_GET_OS_ERROR();
+    }
+    buf.sem_perm.uid  = uid < 0 ? buf.sem_perm.uid : uid;
+    buf.sem_perm.gid  = gid < 0 ? buf.sem_perm.gid : gid;
+    buf.sem_perm.mode = ACR_UnixPermsToMode(perms);
     if (semctl(m->filedes, 0, IPC_SET, ick) < 0) {
         return ACR_GET_OS_ERROR();
     }



Mime
View raw message