RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 12-Oct-2007 00:35:36
Branch: HEAD Handle: 2007101123353501
Modified files:
rpm CHANGES
rpm/rpmio rpmio.c rpmrpc.c
Log:
- fix: set FD_CLOEXEC in Open() and fdDup().
Summary:
Revision Changes Path
1.1670 +1 -0 rpm/CHANGES
1.97 +4 -0 rpm/rpmio/rpmio.c
2.59 +9 -1 rpm/rpmio/rpmrpc.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1669 -r1.1670 CHANGES
--- rpm/CHANGES 11 Oct 2007 19:44:21 -0000 1.1669
+++ rpm/CHANGES 11 Oct 2007 22:35:35 -0000 1.1670
@@ -1,4 +1,5 @@
4.5 -> 5.0:
+ - jbj: fix: set FD_CLOEXEC in Open() and fdDup().
- jbj: eliminate rpmMessage, rpmlog instead.
- jbj: finish eliminating rpmError, rpmlog instead.
- jbj: switch rpmdbRemove to use headerGetExtension.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmio.c
============================================================================
$ cvs diff -u -r1.96 -r1.97 rpmio.c
--- rpm/rpmio/rpmio.c 11 Oct 2007 19:44:24 -0000 1.96
+++ rpm/rpmio/rpmio.c 11 Oct 2007 22:35:36 -0000 1.97
@@ -262,6 +262,10 @@
if ((nfdno = dup(fdno)) < 0)
return NULL;
+ if (fcntl(nfdno, F_SETFD, FD_CLOEXEC)) {
+ (void) close(nfdno);
+ return NULL;
+ }
fd = fdNew("open (fdDup)");
fdSetOpen(fd, "fdDup", nfdno, 0); /* XXX bogus */
fdSetFdno(fd, nfdno);
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmrpc.c
============================================================================
$ cvs diff -u -r2.58 -r2.59 rpmrpc.c
--- rpm/rpmio/rpmrpc.c 6 Oct 2007 21:33:50 -0000 2.58
+++ rpm/rpmio/rpmrpc.c 11 Oct 2007 22:35:36 -0000 2.59
@@ -205,6 +205,7 @@
{
const char * lpath;
int ut = urlPath(path, &lpath);
+ int fdno;
if (_rpmio_debug)
fprintf(stderr, "*** Open(%s, 0x%x, 0%o)\n", path, flags, mode);
@@ -238,7 +239,14 @@
if (mode == 0)
mode = 0644;
#endif
- return open(path, flags, mode);
+ fdno = open(path, flags, mode);
+ if (fdno >= 0) {
+ if (fcntl(fdno, F_SETFD, FD_CLOEXEC) < 0) {
+ (void) close(fdno);
+ fdno = -1;
+ }
+ }
+ return fdno;
}
/* XXX rpmdb.c: analogue to rename(2). */
@@ .
Received on Fri Oct 12 00:35:36 2007