Check-in Number:
|
2376 | |
Date: |
2002-Jul-26 15:34:53 (local)
2002-Jul-26 13:34:53 (UTC) |
User: | rse |
Branch: | |
Comment: |
Make sure that under MM_SEMT_IPCSEM (mutex implementation method is
SysV IPC semget) the {mm,MM}_permission() also changes the owner of
the semaphore.
Submitted by: Jonathan Kamens <jonathank@worldwinner.com> |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/mm/ChangeLog 1.31 -> 1.32
--- ChangeLog 2002/07/26 13:21:31 1.31
+++ ChangeLog 2002/07/26 13:34:53 1.32
@@ -16,6 +16,11 @@
Changes between 1.1.3 and 1.2.0 (01-Jul-2000 to 26-Jul-2002)
+ *) Make sure that under MM_SEMT_IPCSEM (mutex implementation method is
+ SysV IPC semget) the {mm,MM}_permission() also changes the owner of
+ the semaphore.
+ [Jonathan Kamens <jonathank@worldwinner.com>]
+
*) Add support for IRIX 6.5 and other Unix flavors which have
MAXPATHLEN in <sys/param.h>
[Joe Orton <jorton@redhat.com>]
|
|
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;
}
|
|