apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1530623 - in /apr/apr/branches/1.5.x: ./ STATUS shmem/unix/shm.c
Date Wed, 09 Oct 2013 14:21:00 GMT
Author: jim
Date: Wed Oct  9 14:20:59 2013
New Revision: 1530623

URL: http://svn.apache.org/r1530623
Log:
Merge r910597 from trunk:

Make sure we don't leak file descriptors.

Submitted by: jfclere
Reviewed/backported by: jim

Modified:
    apr/apr/branches/1.5.x/   (props changed)
    apr/apr/branches/1.5.x/STATUS
    apr/apr/branches/1.5.x/shmem/unix/shm.c

Propchange: apr/apr/branches/1.5.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r910597

Modified: apr/apr/branches/1.5.x/STATUS
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/STATUS?rev=1530623&r1=1530622&r2=1530623&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/STATUS [utf-8] (original)
+++ apr/apr/branches/1.5.x/STATUS [utf-8] Wed Oct  9 14:20:59 2013
@@ -91,11 +91,6 @@ RELEASE SHOWSTOPPERS:
 
 CURRENT VOTES:
 
-    * shmem: Don't leak file descriptors
-      Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=910597
-      1.5.x patch: trunk patch works
-      +1: jim
-
     * Add object perms set macros and implement them for shm and mutex
       Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=741862
                    http://svn.apache.org/viewvc?view=revision&revision=741869

Modified: apr/apr/branches/1.5.x/shmem/unix/shm.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/shmem/unix/shm.c?rev=1530623&r1=1530622&r2=1530623&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/shmem/unix/shm.c (original)
+++ apr/apr/branches/1.5.x/shmem/unix/shm.c Wed Oct  9 14:20:59 2013
@@ -314,26 +314,31 @@ APR_DECLARE(apr_status_t) apr_shm_create
          * exist before calling ftok(). */
         shmkey = ftok(filename, 1);
         if (shmkey == (key_t)-1) {
+            apr_file_close(file);
             return errno;
         }
 
         if ((new_m->shmid = shmget(shmkey, new_m->realsize,
                                    SHM_R | SHM_W | IPC_CREAT | IPC_EXCL)) < 0) {
+            apr_file_close(file);
             return errno;
         }
 
         if ((new_m->base = shmat(new_m->shmid, NULL, 0)) == (void *)-1) {
+            apr_file_close(file);
             return errno;
         }
         new_m->usable = new_m->base;
 
         if (shmctl(new_m->shmid, IPC_STAT, &shmbuf) == -1) {
+            apr_file_close(file);
             return errno;
         }
         apr_uid_current(&uid, &gid, pool);
         shmbuf.shm_perm.uid = uid;
         shmbuf.shm_perm.gid = gid;
         if (shmctl(new_m->shmid, IPC_SET, &shmbuf) == -1) {
+            apr_file_close(file);
             return errno;
         }
 
@@ -341,6 +346,7 @@ APR_DECLARE(apr_status_t) apr_shm_create
         status = apr_file_write(file, (const void *)&reqsize,
                                 &nbytes);
         if (status != APR_SUCCESS) {
+            apr_file_close(file);
             return status;
         }
         status = apr_file_close(file);



Mime
View raw message