ossp-pkg/mm/mm_core.c 1.14 -> 1.15
--- mm_core.c 2002/07/26 13:04:40 1.14
+++ mm_core.c 2002/07/26 13:34:53 1.15
@@ -419,6 +419,11 @@
{
int rc;
mem_core *mc;
+#if defined(MM_SEMT_IPCSEM)
+ union semun ick;
+ struct semid_ds buf;
+ int sems[2], i;
+#endif
if (core == NULL)
return -1;
@@ -436,6 +441,28 @@
if (rc == 0 && chown(mc->mc_fnsem, owner, group) < 0)
rc = -1;
#endif
+#if defined(MM_SEMT_IPCSEM)
+ if (rc == 0) {
+ sems[0] = mc->mc_fdsem;
+ sems[1] = mc->mc_fdsem_rd;
+ ick.buf = &buf;
+ for (i = 0; i < 2; i++) {
+ if (semctl(sems[i], 0, IPC_STAT, ick) < 0) {
+ rc = -1;
+ break;
+ }
+ if ((int)owner != -1)
+ buf.sem_perm.uid = owner;
+ if ((int)group != -1)
+ buf.sem_perm.gid = group;
+ buf.sem_perm.mode = mode;
+ if (semctl(sems[i], 0, IPC_SET, ick) < 0) {
+ rc = -1;
+ break;
+ }
+ }
+ }
+#endif
return rc;
}
|
|