Print error codes on failure. (NSPRPUB_RELEASE_4_0_BRANCH) NSPRPUB_RELEASE_4_0_BRANCH
authorwtc%netscape.com
Wed, 26 Jan 2000 04:53:18 +0000
branchNSPRPUB_RELEASE_4_0_BRANCH
changeset 1083 9c5239ca316b254855fd6d555ce83583c3646903
parent 1082 84e90035ae01f09504b59ef2d13d1bc435a41ae0
child 1084 6e36dc35d793cad49b041c7aa31d14c467235268
push idunknown
push userunknown
push dateunknown
Print error codes on failure. (NSPRPUB_RELEASE_4_0_BRANCH) Modified files: semaping.c, semapong.c
pr/tests/semaping.c
pr/tests/semapong.c
--- a/pr/tests/semaping.c
+++ b/pr/tests/semaping.c
@@ -80,34 +80,36 @@ int main(int argc, char **argv)
     }
     if (PR_DeleteSemaphore(SEM_NAME2) == PR_SUCCESS) {
         fprintf(stderr, "warning: removed semaphore %s left over "
                 "from previous run\n", SEM_NAME2);
     }
 
     shm = PR_OpenSharedMemory(SHM_NAME, sizeof(*counter_addr), PR_SHM_CREATE, SHM_MODE);
     if (NULL == shm) {
-        fprintf(stderr, "PR_OpenSharedMemory failed\n");
+        fprintf(stderr, "PR_OpenSharedMemory failed (%d, %d)\n",
+                PR_GetError(), PR_GetOSError());
         exit(1);
     }
     counter_addr = PR_AttachSharedMemory(shm, 0);
     if (NULL == counter_addr) {
         fprintf(stderr, "PR_AttachSharedMemory failed\n");
         exit(1);
     }
     *counter_addr = 0;
     sem1 = PR_OpenSemaphore(SEM_NAME1, PR_SEM_CREATE, SEM_MODE, 1);
     if (NULL == sem1) {
         fprintf(stderr, "PR_OpenSemaphore failed (%d, %d)\n",
                 PR_GetError(), PR_GetOSError());
         exit(1);
     }
     sem2 = PR_OpenSemaphore(SEM_NAME2, PR_SEM_CREATE, SEM_MODE, 0);
     if (NULL == sem2) {
-        fprintf(stderr, "PR_OpenSemaphore failed\n");
+        fprintf(stderr, "PR_OpenSemaphore failed (%d, %d)\n",
+                PR_GetError(), PR_GetOSError());
         exit(1);
     }
 
     child_arg = &child_argv[0];
     *child_arg++ = "semapong";
     if (debug_mode != PR_FALSE) {
         *child_arg++ = "-d";
     }
--- a/pr/tests/semapong.c
+++ b/pr/tests/semapong.c
@@ -60,28 +60,30 @@ int main(int argc, char **argv)
                 Help();
                 return 2;
         }
     }
     PL_DestroyOptState(opt);
 
     shm = PR_OpenSharedMemory(SHM_NAME, sizeof(*counter_addr), 0, 0666);
     if (NULL == shm) {
-        fprintf(stderr, "PR_OpenSharedMemory failed\n");
+        fprintf(stderr, "PR_OpenSharedMemory failed (%d, %d)\n",
+                PR_GetError(), PR_GetOSError());
         exit(1);
     }
     sem1 = PR_OpenSemaphore(SEM_NAME1, 0, 0, 0);
     if (NULL == sem1) {
         fprintf(stderr, "PR_OpenSemaphore failed (%d, %d)\n",
                 PR_GetError(), PR_GetOSError());
         exit(1);
     }
     sem2 = PR_OpenSemaphore(SEM_NAME2, 0, 0, 0);
     if (NULL == sem2) {
-        fprintf(stderr, "PR_OpenSemaphore failed\n");
+        fprintf(stderr, "PR_OpenSemaphore failed (%d, %d)\n",
+                PR_GetError(), PR_GetOSError());
         exit(1);
     }
 
     counter_addr = PR_AttachSharedMemory(shm, 0);
     if (NULL == counter_addr) {
         fprintf(stderr, "PR_AttachSharedMemory failed\n");
         exit(1);
     }