Fix file descriptor leak
src/semanage_store.c +2 -0
@@ -1159,6 +1159,8 @@ERR (sh,"Could not open direct %s at %s." , lock_name, lock_file);return -1 ; } +fcntl (fd,FD_CLOEXEC ,0 ); +if (sh->timeout ==0 ) {/* return immediately */ origtime.tv_sec =0 ;
On Wed, 2006-03-29 at 15:33 -0500, Daniel J Walsh wrote:
src/semanage_store.c +2 -0
@@ -1159,6 +1159,8 @@ERR (sh,"Could not open direct %s at %s." , lock_name, lock_file);return -1 ; } +fcntl (fd,FD_CLOEXEC ,0 ); +if (sh->timeout ==0 ) {/* return immediately */ origtime.tv_sec =0 ;
Shouldn't that be:
fcntl(fd, F_SETFD, FD_CLOEXEC)?
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 14 lines · Stephen Smalley
On Wed, 2006-03-29 at 15:33 -0500, Daniel J Walsh wrote:
diff --exclude-from=exclude -N -u -rnsalibsemanage/src/semanage_store.clibsemanage-1.6.2/src/semanage_store.csrc/semanage_store.c +2
-0@@ -1159,6 +1159,8 @@ERR (sh,"Could not open direct %s at %s." , lock_name, lock_file);return -1 ; } +fcntl (fd,FD_CLOEXEC ,0 ); +if (sh->timeout ==0 ) {/* return immediately */ origtime.tv_sec =0 ;
Quoted 4 lines
Shouldn't that be:
fcntl(fd, F_SETFD, FD_CLOEXEC)?
yes
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 15 lines · Daniel J Walsh
Quoted 14 lines · Stephen Smalley
On Wed, 2006-03-29 at 15:33 -0500, Daniel J Walsh wrote:
diff --exclude-from=exclude -N -u -rnsalibsemanage/src/semanage_store.clibsemanage-1.6.2/src/semanage_store.csrc/semanage_store.c +2
-0@@ -1159,6 +1159,8 @@ERR (sh,"Could not open direct %s at %s." , lock_name, lock_file);return -1 ; } +fcntl (fd,FD_CLOEXEC ,0 ); +if (sh->timeout ==0 ) {/* return immediately */ origtime.tv_sec =0 ;
Quoted 5 lines
Quoted 4 lines
Shouldn't that be:
fcntl(fd, F_SETFD, FD_CLOEXEC)?yes
Ok, merged the following internally. Waiting for sourceforge to come back.
Index: libsemanage/src/semanage_store.c
===================================================================
RCS file: /nfshome/pal/CVS/selinux-usr/libsemanage/src/semanage_store.c,v retrieving revision 1.44
src/semanage_store.c +6 -0
@@ -1159,6 +1159,12 @@ static int semanage_get_lock(semanage_haERR (sh,"Could not open direct %s at %s." , lock_name, lock_file);return -1 ; } +if (fcntl (fd,F_SETFD ,FD_CLOEXEC ) <0 ) { +ERR (sh,"Could not set close-on-exec for %s at %s." , lock_name, lock_file); +close (fd); +return -1 ; + } +if (sh->timeout ==0 ) {/* return immediately */ origtime.tv_sec =0 ;
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.