You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/26 19:08:43 UTC
svn commit: r819178 -
/commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c
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();
}