commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r834955 - /commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
Date Wed, 11 Nov 2009 16:43:37 GMT
Author: mturk
Date: Wed Nov 11 16:43:37 2009
New Revision: 834955

URL: http://svn.apache.org/viewvc?rev=834955&view=rev
Log:
Unlink the header file if shm create failed

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c?rev=834955&r1=834954&r2=834955&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c Wed Nov 11 16:43:37 2009
@@ -243,9 +243,8 @@
         shm->reqsize  = reqsize;
         shm->filename = ACR_StrdupA(_E, THROW_FMARK, filename);
         if (!shm->filename) {
-            rc =  ACR_GET_OS_ERROR();
             x_free(shm);
-            ACR_SET_OS_ERROR(rc);
+            ACR_SET_OS_ERROR(ACR_ENOMEM);
             return -1;
         }
 
@@ -302,8 +301,14 @@
             goto finally;
         }
 finally:
-        if (file > 0)
-            rc = close(file);
+        if (file > 0) {
+            close(file);
+            if (rc) {
+                /* Remove header file
+                 */
+                unlink(filename);
+            }
+        }
         if (rc) {
             x_free((void *)(shm->filename));
             x_free(shm);
@@ -358,8 +363,7 @@
         close(file);
         goto finally;
     }
-    rc = close(file);
-    if (rc) {
+    if (close(file)) {
         rc = ACR_GET_OS_ERROR();
         goto finally;
     }



Mime
View raw message