summaryrefslogtreecommitdiff
blob: 45e1e71044113b23cf5959dab3123c7d26e63e2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff -Naur opencryptoki-2.2.8.orig/usr/sbin/pkcsslotd/shmem.c opencryptoki-2.2.8/usr/sbin/pkcsslotd/shmem.c
--- opencryptoki-2.2.8.orig/usr/sbin/pkcsslotd/shmem.c	2010-06-02 09:18:27.000000000 -0700
+++ opencryptoki-2.2.8/usr/sbin/pkcsslotd/shmem.c	2010-06-02 11:41:31.000000000 -0700
@@ -374,10 +374,20 @@
 
 
    if ( shmid < 0 ) {
-      ErrLog(SLOTD_MSG(SHMEMCR, 
-              "Shared memory creation failed (0x%X)\n"), errno);
-      ErrLog(SLOTD_MSG(IPCRM, "perform ipcrm -M 0x%X\n"), tok);
-      return FALSE;
+      ErrLog(SLOTD_MSG(SHMEMCR,
+                       "Shared memory creation failed (0x%X)\n"), errno);
+      ErrLog(SLOTD_MSG(SHMEMCR, "Reclaiming 0x%X\n"), tok);
+      shmid = shmget( tok, sizeof( Slot_Mgr_Shr_t ), 0 );
+      DestroySharedMemory();
+      shmid = shmget( tok, sizeof( Slot_Mgr_Shr_t ),
+                      IPC_CREAT | IPC_EXCL |  S_IRUSR |
+	              S_IRGRP  | S_IWUSR | S_IWGRP   );
+      if ( shmid < 0 ) {
+          ErrLog(SLOTD_MSG(SHMEMCR,
+                           "Shared memory reclamation failed (0x%X)\n"), errno);
+          ErrLog(SLOTD_MSG(IPCRM, "perform ipcrm -M 0x%X\n"), tok);
+          return FALSE;
+      }
    }
 
    // SAB Set the group ownership of the shared mem segment..