Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 833223 Details for
Bug 919801
SELinux is preventing /usr/sbin/sendmail.postfix from 'read' accesses on the directory /home/dummy.
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Use CLO_EXEC
rpm-4.11.1-cloexec.patch (text/plain), 23.83 KB, created by
Jaroslav Škarvada
on 2013-12-05 15:47:59 UTC
(
hide
)
Description:
Use CLO_EXEC
Filename:
MIME Type:
Creator:
Jaroslav Škarvada
Created:
2013-12-05 15:47:59 UTC
Size:
23.83 KB
patch
obsolete
>From d469f02619103362873f8a42a44ce4c58316a6e8 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskarvad@redhat.com> >Date: Fri, 29 Nov 2013 14:02:23 +0100 >Subject: [PATCH] opening files with cloexec >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Jaroslav Å karvada <jskarvad@redhat.com> >--- > build/files.c | 2 +- > build/pack.c | 6 +++--- > build/parsePreamble.c | 2 +- > build/parseSpec.c | 2 +- > lib/backend/db3.c | 2 +- > lib/fsm.c | 6 +++--- > lib/rpmchecksig.c | 2 +- > lib/rpmchroot.c | 2 +- > lib/rpmdb.c | 8 ++++---- > lib/rpmgi.c | 4 ++-- > lib/rpminstall.c | 8 ++++---- > lib/rpmlock.c | 4 ++-- > lib/rpmrc.c | 8 ++++---- > lib/rpmscript.c | 4 ++-- > lib/rpmts.c | 2 +- > lib/signature.c | 2 +- > misc/fts.c | 10 +++++----- > plugins/sepolicy.c | 4 ++-- > rpm2cpio.c | 4 ++-- > rpmbuild.c | 4 ++-- > rpmio/macro.c | 4 ++-- > rpmio/rpmfileutil.c | 6 +++--- > rpmio/rpmio.c | 6 +++++- > rpmsign.c | 4 ++-- > sign/rpmgensig.c | 10 +++++----- > tools/debugedit.c | 4 ++-- > tools/elfdeps.c | 2 +- > tools/rpmgraph.c | 4 ++-- > tools/sepdebugcrcfix.c | 4 ++-- > 29 files changed, 67 insertions(+), 63 deletions(-) > >diff --git a/build/files.c b/build/files.c >index eed5696..9803db2 100644 >--- a/build/files.c >+++ b/build/files.c >@@ -1686,7 +1686,7 @@ static rpmRC readFilesManifest(rpmSpec spec, Package pkg, const char *path) > fn = rpmGetPath("%{_builddir}/", > (spec->buildSubdir ? spec->buildSubdir : "") , "/", path, NULL); > } >- fd = fopen(fn, "r"); >+ fd = fopen(fn, "re"); > > if (fd == NULL) { > rpmlog(RPMLOG_ERR, _("Could not open %%files file %s: %m\n"), fn); >diff --git a/build/pack.c b/build/pack.c >index ab23908..0c4c5c4 100644 >--- a/build/pack.c >+++ b/build/pack.c >@@ -70,7 +70,7 @@ static rpmRC addFileToTag(rpmSpec spec, const char * file, > > fn = rpmGetPath("%{_builddir}/%{?buildsubdir:%{buildsubdir}/}", file, NULL); > >- f = fopen(fn, "r"); >+ f = fopen(fn, "re"); > if (f == NULL) { > rpmlog(RPMLOG_ERR,_("Could not open %s file: %s\n"), > rpmTagGetName(tag), file); >@@ -422,7 +422,7 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp, > } > > /* Open the output file */ >- fd = Fopen(fileName, "w.ufdio"); >+ fd = Fopen(fileName, "we.ufdio"); > if (fd == NULL || Ferror(fd)) { > rc = RPMRC_FAIL; > rpmlog(RPMLOG_ERR, _("Could not open %s: %s\n"), >@@ -450,7 +450,7 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp, > } > > /* Append the header and archive */ >- ifd = Fopen(sigtarget, "r.ufdio"); >+ ifd = Fopen(sigtarget, "re.ufdio"); > if (ifd == NULL || Ferror(ifd)) { > rc = RPMRC_FAIL; > rpmlog(RPMLOG_ERR, _("Unable to open sigtarget %s: %s\n"), >diff --git a/build/parsePreamble.c b/build/parsePreamble.c >index e4b1f94..bf9725f 100644 >--- a/build/parsePreamble.c >+++ b/build/parsePreamble.c >@@ -549,7 +549,7 @@ static rpmRC readIcon(Header h, const char * file) > /* XXX use rpmGenPath(rootdir, "%{_sourcedir}/", file) for icon path. */ > fn = rpmGetPath("%{_sourcedir}/", file, NULL); > >- fd = Fopen(fn, "r.ufdio"); >+ fd = Fopen(fn, "re.ufdio"); > if (fd == NULL) { > rpmlog(RPMLOG_ERR, _("Unable to open icon %s: %s\n"), > fn, Fstrerror(fd)); >diff --git a/build/parseSpec.c b/build/parseSpec.c >index 9b0c542..146a1a7 100644 >--- a/build/parseSpec.c >+++ b/build/parseSpec.c >@@ -247,7 +247,7 @@ static int readLineFromOFI(rpmSpec spec, OFI_t *ofi) > retry: > /* Make sure the current file is open */ > if (ofi->fp == NULL) { >- ofi->fp = fopen(ofi->fileName, "r"); >+ ofi->fp = fopen(ofi->fileName, "re"); > if (ofi->fp == NULL) { > rpmlog(RPMLOG_ERR, _("Unable to open %s: %s\n"), > ofi->fileName, strerror(errno)); >diff --git a/lib/backend/db3.c b/lib/backend/db3.c >index 9d385c6..c61ff10 100644 >--- a/lib/backend/db3.c >+++ b/lib/backend/db3.c >@@ -65,7 +65,7 @@ static int serialize_env(const char *dbhome) > { > char *lock_path = rstrscat(NULL, dbhome, "/.dbenv.lock", NULL); > mode_t oldmask = umask(022); >- int fd = open(lock_path, (O_RDWR|O_CREAT), 0644); >+ int fd = open(lock_path, (O_RDWR|O_CREAT|O_CLOEXEC), 0644); > umask(oldmask); > > if (fd >= 0) { >diff --git a/lib/fsm.c b/lib/fsm.c >index 1ee7e67..3b86fd4 100644 >--- a/lib/fsm.c >+++ b/lib/fsm.c >@@ -731,7 +731,7 @@ static int expandRegular(FSM_t fsm, rpmpsm psm, rpmcpio_t archive, int nodigest) > pgpHashAlgo digestalgo = 0; > int rc = 0; > >- wfd = Fopen(fsm->path, "w.ufdio"); >+ wfd = Fopen(fsm->path, "we.ufdio"); > if (Ferror(wfd)) { > rc = CPIOERR_OPEN_FAILED; > goto exit; >@@ -864,7 +864,7 @@ static int writeFile(FSM_t fsm, int writeData, rpmcpio_t archive, int ix) > if (writeData && S_ISREG(st->st_mode)) { > size_t len; > >- rfd = Fopen(fsm->path, "r.ufdio"); >+ rfd = Fopen(fsm->path, "re.ufdio"); > if (Ferror(rfd)) { > rc = CPIOERR_OPEN_FAILED; > goto exit; >@@ -1870,7 +1870,7 @@ int rpmPackageFilesArchive(rpmfi fi, int isSrc, FD_t cfd, > { > rpmfs fs = rpmfsNew(rpmfiFC(fi), 0);; > FSM_t fsm = fsmNew(FSM_PKGBUILD, fs, fi, failedFile);; >- rpmcpio_t archive = rpmcpioOpen(cfd, O_WRONLY); >+ rpmcpio_t archive = rpmcpioOpen(cfd, O_WRONLY | O_CLOEXEC); > int rc = 0; > > fsm->mapFlags |= CPIO_MAP_TYPE; >diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c >index 0d3e95a..375aaa9 100644 >--- a/lib/rpmchecksig.c >+++ b/lib/rpmchecksig.c >@@ -428,7 +428,7 @@ int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv) > verifyFlags &= ~rpmcliQueryFlags; > > while ((arg = *argv++) != NULL) { >- FD_t fd = Fopen(arg, "r.ufdio"); >+ FD_t fd = Fopen(arg, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > rpmlog(RPMLOG_ERR, _("%s: open failed: %s\n"), > arg, Fstrerror(fd)); >diff --git a/lib/rpmchroot.c b/lib/rpmchroot.c >index 81bb5e5..665681a 100644 >--- a/lib/rpmchroot.c >+++ b/lib/rpmchroot.c >@@ -38,7 +38,7 @@ int rpmChrootSet(const char *rootDir) > > if (rootDir != NULL) { > rootState.rootDir = rstrdup(rootDir); >- rootState.cwd = open(".", O_RDONLY); >+ rootState.cwd = open(".", O_RDONLY | O_CLOEXEC); > if (rootState.cwd < 0) { > rpmlog(RPMLOG_ERR, _("Unable to open current directory: %m\n")); > rc = -1; >diff --git a/lib/rpmdb.c b/lib/rpmdb.c >index efaa395..7f75be3 100644 >--- a/lib/rpmdb.c >+++ b/lib/rpmdb.c >@@ -877,7 +877,7 @@ int rpmdbInit (const char * prefix, int perms) > rpmdb db = NULL; > int rc; > >- rc = openDatabase(prefix, NULL, &db, (O_CREAT | O_RDWR), perms, 0); >+ rc = openDatabase(prefix, NULL, &db, (O_CREAT | O_RDWR | O_CLOEXEC), perms, 0); > if (db != NULL) { > int xx; > xx = rpmdbOpenAll(db); >@@ -894,7 +894,7 @@ int rpmdbVerify(const char * prefix) > rpmdb db = NULL; > int rc = 0; > >- rc = openDatabase(prefix, NULL, &db, O_RDONLY, 0644, RPMDB_FLAG_VERIFYONLY); >+ rc = openDatabase(prefix, NULL, &db, O_RDONLY | O_CLOEXEC, 0644, RPMDB_FLAG_VERIFYONLY); > > if (db != NULL) { > int xx; >@@ -2880,12 +2880,12 @@ int rpmdbRebuild(const char * prefix, rpmts ts, > removedir = 1; > > if (openDatabase(prefix, dbpath, &olddb, >- O_RDONLY, 0644, RPMDB_FLAG_REBUILD)) { >+ O_RDONLY | O_CLOEXEC, 0644, RPMDB_FLAG_REBUILD)) { > rc = 1; > goto exit; > } > if (openDatabase(prefix, newdbpath, &newdb, >- (O_RDWR | O_CREAT), 0644, RPMDB_FLAG_REBUILD)) { >+ (O_RDWR | O_CREAT | O_CLOEXEC), 0644, RPMDB_FLAG_REBUILD)) { > rc = 1; > goto exit; > } >diff --git a/lib/rpmgi.c b/lib/rpmgi.c >index 89707df..0638d80 100644 >--- a/lib/rpmgi.c >+++ b/lib/rpmgi.c >@@ -63,7 +63,7 @@ static FD_t rpmgiOpen(const char * path, const char * fmode) > */ > static rpmRC rpmgiLoadManifest(rpmgi gi, const char * path) > { >- FD_t fd = rpmgiOpen(path, "r.ufdio"); >+ FD_t fd = rpmgiOpen(path, "re.ufdio"); > rpmRC rpmrc = RPMRC_FAIL; > > if (fd != NULL) { >@@ -82,7 +82,7 @@ static rpmRC rpmgiLoadManifest(rpmgi gi, const char * path) > */ > static int rpmgiReadHeader(rpmgi gi, const char * path, Header * hdrp) > { >- FD_t fd = rpmgiOpen(path, "r.ufdio"); >+ FD_t fd = rpmgiOpen(path, "re.ufdio"); > Header h = NULL; > > if (fd != NULL) { >diff --git a/lib/rpminstall.c b/lib/rpminstall.c >index a3623fd..2544116 100644 >--- a/lib/rpminstall.c >+++ b/lib/rpminstall.c >@@ -109,7 +109,7 @@ void * rpmShowProgress(const void * arg, > case RPMCALLBACK_INST_OPEN_FILE: > if (filename == NULL || filename[0] == '\0') > return NULL; >- fd = Fopen(filename, "r.ufdio"); >+ fd = Fopen(filename, "re.ufdio"); > /* FIX: still necessary? */ > if (fd == NULL || Ferror(fd)) { > rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), filename, >@@ -303,7 +303,7 @@ static int tryReadManifest(struct rpmEIU * eiu) > int rc; > > /* Try to read a package manifest. */ >- FD_t fd = Fopen(*eiu->fnp, "r.ufdio"); >+ FD_t fd = Fopen(*eiu->fnp, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), *eiu->fnp, > Fstrerror(fd)); >@@ -332,7 +332,7 @@ static int tryReadManifest(struct rpmEIU * eiu) > static int tryReadHeader(rpmts ts, struct rpmEIU * eiu, Header * hdrp) > { > /* Try to read the header from a package file. */ >- FD_t fd = Fopen(*eiu->fnp, "r.ufdio"); >+ FD_t fd = Fopen(*eiu->fnp, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), *eiu->fnp, > Fstrerror(fd)); >@@ -695,7 +695,7 @@ int rpmInstallSource(rpmts ts, const char * arg, > int rc; > > >- fd = Fopen(arg, "r.ufdio"); >+ fd = Fopen(arg, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > rpmlog(RPMLOG_ERR, _("cannot open %s: %s\n"), arg, Fstrerror(fd)); > if (fd != NULL) (void) Fclose(fd); >diff --git a/lib/rpmlock.c b/lib/rpmlock.c >index cf9947e..7080b4d 100644 >--- a/lib/rpmlock.c >+++ b/lib/rpmlock.c >@@ -29,11 +29,11 @@ static rpmlock rpmlock_new(const char *lock_path) > > if (lock != NULL) { > mode_t oldmask = umask(022); >- lock->fd = open(lock_path, O_RDWR|O_CREAT, 0644); >+ lock->fd = open(lock_path, O_RDWR|O_CREAT|O_CLOEXEC, 0644); > (void) umask(oldmask); > > if (lock->fd == -1) { >- lock->fd = open(lock_path, O_RDONLY); >+ lock->fd = open(lock_path, O_RDONLY | O_CLOEXEC); > if (lock->fd == -1) { > free(lock); > lock = NULL; >diff --git a/lib/rpmrc.c b/lib/rpmrc.c >index efbe518..7cfb659 100644 >--- a/lib/rpmrc.c >+++ b/lib/rpmrc.c >@@ -712,7 +712,7 @@ exit: > static int is_sun4v() > { > char buffer[4096], *p; >- int fd = open("/proc/cpuinfo", O_RDONLY); >+ int fd = open("/proc/cpuinfo", O_RDONLY | O_CLOEXEC); > if (read(fd, &buffer, sizeof(buffer) - 1) == -1) { > rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n")); > close(fd); >@@ -737,7 +737,7 @@ static int is_sun4v() > static int has_neon() > { > char buffer[4096], *p; >- int fd = open("/proc/cpuinfo", O_RDONLY); >+ int fd = open("/proc/cpuinfo", O_RDONLY | O_CLOEXEC); > if (read(fd, &buffer, sizeof(buffer) - 1) == -1) { > rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n")); > close(fd); >@@ -761,7 +761,7 @@ static int has_neon() > static int has_hfp() > { > char buffer[4096], *p; >- int fd = open("/proc/cpuinfo", O_RDONLY); >+ int fd = open("/proc/cpuinfo", O_RDONLY | O_CLOEXEC); > if (read(fd, &buffer, sizeof(buffer) - 1) == -1) { > rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n")); > close(fd); >@@ -995,7 +995,7 @@ static void parse_auxv(void) > > if (oneshot) { > rpmat.platform = ""; >- int fd = open("/proc/self/auxv", O_RDONLY); >+ int fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC); > > if (fd == -1) { > rpmlog(RPMLOG_WARNING, >diff --git a/lib/rpmscript.c b/lib/rpmscript.c >index 57c24c6..fffd62d 100644 >--- a/lib/rpmscript.c >+++ b/lib/rpmscript.c >@@ -62,7 +62,7 @@ static rpmRC runLuaScript(int selinux, ARGV_const_t prefixes, > > /* Lua scripts can change our cwd and umask, save and restore */ > /* XXX TODO: use cwd from chroot state to save unnecessary open here */ >- cwd = open(".", O_RDONLY); >+ cwd = open(".", O_RDONLY | O_CLOEXEC); > if (cwd != -1) { > mode_t oldmask = umask(0); > umask(oldmask); >@@ -236,7 +236,7 @@ static rpmRC runExtScript(int selinux, ARGV_const_t prefixes, > if (rpmIsVerbose()) { > out = fdDup(Fileno(scriptFd)); > } else { >- out = Fopen("/dev/null", "w.fdio"); >+ out = Fopen("/dev/null", "we.fdio"); > if (Ferror(out)) { > out = fdDup(Fileno(scriptFd)); > } >diff --git a/lib/rpmts.c b/lib/rpmts.c >index 9642734..69bc677 100644 >--- a/lib/rpmts.c >+++ b/lib/rpmts.c >@@ -473,7 +473,7 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen > > /* Add header to database. */ > if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) { >- if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT))) >+ if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT|O_CLOEXEC))) > goto exit; > if (rpmdbAdd(rpmtsGetRdb(ts), h) != 0) > goto exit; >diff --git a/lib/signature.c b/lib/signature.c >index 1c53270..67c3747 100644 >--- a/lib/signature.c >+++ b/lib/signature.c >@@ -293,7 +293,7 @@ static int makeHDRDigest(Header sigh, const char * file, rpmTagVal sigTag) > > switch (sigTag) { > case RPMSIGTAG_SHA1: >- fd = Fopen(file, "r.fdio"); >+ fd = Fopen(file, "re.fdio"); > if (fd == NULL || Ferror(fd)) > goto exit; > h = headerRead(fd, HEADER_MAGIC_YES); >diff --git a/misc/fts.c b/misc/fts.c >index 9fbefe3..c455a1f 100644 >--- a/misc/fts.c >+++ b/misc/fts.c >@@ -221,7 +221,7 @@ Fts_open(char * const * argv, int options, > * descriptor we run anyway, just more slowly. > */ > if (!ISSET(FTS_NOCHDIR) >- && (sp->fts_rfd = __open(".", O_RDONLY, 0)) < 0) >+ && (sp->fts_rfd = __open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) > SET(FTS_NOCHDIR); > > return (sp); >@@ -350,7 +350,7 @@ Fts_read(FTS * sp) > (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { > p->fts_info = fts_stat(sp, p, 1); > if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { >- if ((p->fts_symfd = __open(".", O_RDONLY, 0)) < 0) { >+ if ((p->fts_symfd = __open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) { > p->fts_errno = errno; > p->fts_info = FTS_ERR; > } else >@@ -441,7 +441,7 @@ next: tmp = p; > p->fts_info = fts_stat(sp, p, 1); > if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { > if ((p->fts_symfd = >- __open(".", O_RDONLY, 0)) < 0) { >+ __open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) { > p->fts_errno = errno; > p->fts_info = FTS_ERR; > } else >@@ -576,7 +576,7 @@ Fts_children(FTS * sp, int instr) > ISSET(FTS_NOCHDIR)) > return (sp->fts_child = fts_build(sp, instr)); > >- if ((fd = __open(".", O_RDONLY, 0)) < 0) >+ if ((fd = __open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) > return (NULL); > sp->fts_child = fts_build(sp, instr); > if (__fchdir(fd)) >@@ -1116,7 +1116,7 @@ fts_safe_changedir(FTS * sp, FTSENT * p, int fd, const char * path) > newfd = fd; > if (ISSET(FTS_NOCHDIR)) > return (0); >- if (fd < 0 && (newfd = __open(path, O_RDONLY, 0)) < 0) >+ if (fd < 0 && (newfd = __open(path, O_RDONLY | O_CLOEXEC, 0)) < 0) > return (-1); > if (__fxstat64(_STAT_VER, newfd, &sb)) { > ret = -1; >diff --git a/plugins/sepolicy.c b/plugins/sepolicy.c >index 86bf198..4274ab4 100644 >--- a/plugins/sepolicy.c >+++ b/plugins/sepolicy.c >@@ -442,7 +442,7 @@ static rpmRC sepoltransCommit(sepoltrans * pt) > rc = RPMRC_FAIL; > break; > case 0: >- fd = open("/dev/null", O_RDWR); >+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); > dup2(fd, STDIN_FILENO); > dup2(fd, STDOUT_FILENO); > dup2(fd, STDERR_FILENO); >@@ -494,7 +494,7 @@ static rpmRC sepolRelabelFiles(void) > rc = RPMRC_FAIL; > break; > case 0: >- fd = open("/dev/null", O_RDWR); >+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); > dup2(fd, STDIN_FILENO); > dup2(fd, STDOUT_FILENO); > dup2(fd, STDERR_FILENO); >diff --git a/rpm2cpio.c b/rpm2cpio.c >index 89ebdfa..cb136ca 100644 >--- a/rpm2cpio.c >+++ b/rpm2cpio.c >@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) > fprintf(stderr, "Usage: rpm2cpio file.rpm\n"); > exit(EXIT_FAILURE); > } >- fdi = Fopen(argv[1], "r.ufdio"); >+ fdi = Fopen(argv[1], "re.ufdio"); > } > > if (Ferror(fdi)) { >@@ -72,7 +72,7 @@ int main(int argc, char *argv[]) > > /* Retrieve payload size and compression type. */ > { const char *compr = headerGetString(h, RPMTAG_PAYLOADCOMPRESSOR); >- rpmio_flags = rstrscat(NULL, "r.", compr ? compr : "gzip", NULL); >+ rpmio_flags = rstrscat(NULL, "re.", compr ? compr : "gzip", NULL); > payload_size = headerGetNumber(h, RPMTAG_LONGARCHIVESIZE); > } > >diff --git a/rpmbuild.c b/rpmbuild.c >index e0a6823..38b9495 100644 >--- a/rpmbuild.c >+++ b/rpmbuild.c >@@ -250,7 +250,7 @@ static int isSpecFile(const char * specfile) > int count; > int checking; > >- f = fopen(specfile, "r"); >+ f = fopen(specfile, "re"); > if (f == NULL) { > rpmlog(RPMLOG_ERR, _("Unable to open spec file %s: %s\n"), > specfile, strerror(errno)); >@@ -313,7 +313,7 @@ static char * getTarSpec(const char *arg) > "%{__tar} xOvf - --wildcards ", *spec, > " 2>&1 > ", tmpSpecFile, NULL); > >- if (!(fp = popen(cmd, "r"))) { >+ if (!(fp = popen(cmd, "re"))) { > rpmlog(RPMLOG_ERR, _("Failed to open tar pipe: %m\n")); > } else { > char *fok; >diff --git a/rpmio/macro.c b/rpmio/macro.c >index 09cb563..557cabd 100644 >--- a/rpmio/macro.c >+++ b/rpmio/macro.c >@@ -405,7 +405,7 @@ doShellEscape(MacroBuf mb, const char * cmd, size_t clen) > if (rc) > goto exit; > >- if ((shf = popen(buf, "r")) == NULL) { >+ if ((shf = popen(buf, "re")) == NULL) { > rc = 1; > goto exit; > } >@@ -1392,7 +1392,7 @@ rpmLoadMacros(rpmMacroContext mc, int level) > int > rpmLoadMacroFile(rpmMacroContext mc, const char * fn) > { >- FILE *fd = fopen(fn, "r"); >+ FILE *fd = fopen(fn, "re"); > size_t blen = MACROBUFSIZ; > char *buf = xmalloc(blen); > int rc = -1; >diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c >index 9d3b04b..eeb7b33 100644 >--- a/rpmio/rpmfileutil.c >+++ b/rpmio/rpmfileutil.c >@@ -93,7 +93,7 @@ static int open_dso(const char * path, pid_t * pidp, rpm_loff_t *fsizep) > *fsizep = st->st_size; > } > >- fdno = open(path, O_RDONLY); >+ fdno = open(path, O_RDONLY | O_CLOEXEC); > if (fdno < 0) > return fdno; > >@@ -170,7 +170,7 @@ int rpmDoDigest(int algo, const char * fn,int asAscii, > case URL_IS_DASH: > default: > /* Either use the pipe to prelink -y or open the URL. */ >- fd = (pid != 0) ? fdDup(fdno) : Fopen(fn, "r.ufdio"); >+ fd = (pid != 0) ? fdDup(fdno) : Fopen(fn, "re.ufdio"); > (void) close(fdno); > if (fd == NULL || Ferror(fd)) { > rc = 1; >@@ -314,7 +314,7 @@ int rpmFileIsCompressed(const char * file, rpmCompressedMagic * compressed) > > *compressed = COMPRESSED_NOT; > >- fd = Fopen(file, "r.ufdio"); >+ fd = Fopen(file, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > /* XXX Fstrerror */ > rpmlog(RPMLOG_ERR, _("File %s: %s\n"), file, Fstrerror(fd)); >diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c >index cd223e8..cd9e500 100644 >--- a/rpmio/rpmio.c >+++ b/rpmio/rpmio.c >@@ -1331,6 +1331,10 @@ static void cvtfmode (const char *m, > flags |= O_RDONLY; > if (--nstdio > 0) *stdio++ = *m; > break; >+ case 'e': >+ flags |= O_CLOEXEC; >+ if (--nstdio > 0) *stdio++ = *m; >+ break; > default: > *stdio = '\0'; > return; >@@ -1584,7 +1588,7 @@ int rpmioSlurp(const char * fn, uint8_t ** bp, ssize_t * blenp) > FD_t fd; > int rc = 0; > >- fd = Fopen(fn, "r.ufdio"); >+ fd = Fopen(fn, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > rc = 2; > goto exit; >diff --git a/rpmsign.c b/rpmsign.c >index b8e5598..f62bafb 100644 >--- a/rpmsign.c >+++ b/rpmsign.c >@@ -70,11 +70,11 @@ static int checkPassPhrase(const char * passPhrase) > close(STDIN_FILENO); > close(STDOUT_FILENO); > close(passPhrasePipe[1]); >- if ((fdno = open("/dev/null", O_RDONLY)) != STDIN_FILENO) { >+ if ((fdno = open("/dev/null", O_RDONLY | O_CLOEXEC)) != STDIN_FILENO) { > xx = dup2(fdno, STDIN_FILENO); > close(fdno); > } >- if ((fdno = open("/dev/null", O_WRONLY)) != STDOUT_FILENO) { >+ if ((fdno = open("/dev/null", O_WRONLY | O_CLOEXEC)) != STDOUT_FILENO) { > xx = dup2(fdno, STDOUT_FILENO); > close(fdno); > } >diff --git a/sign/rpmgensig.c b/sign/rpmgensig.c >index 7695ffa..9792d24 100644 >--- a/sign/rpmgensig.c >+++ b/sign/rpmgensig.c >@@ -76,9 +76,9 @@ static int copyFile(FD_t *sfdp, const char *sfnp, > ssize_t count; > int rc = 1; > >- if (manageFile(sfdp, sfnp, O_RDONLY)) >+ if (manageFile(sfdp, sfnp, O_RDONLY|O_CLOEXEC)) > goto exit; >- if (manageFile(tfdp, tfnp, O_WRONLY|O_CREAT|O_TRUNC)) >+ if (manageFile(tfdp, tfnp, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC)) > goto exit; > > while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), *sfdp)) > 0) >@@ -254,7 +254,7 @@ static int makeGPGSignature(Header sigh, int ishdr, > { FD_t fd; > > rc = 0; >- fd = Fopen(sigfile, "r.ufdio"); >+ fd = Fopen(sigfile, "re.ufdio"); > if (fd != NULL && !Ferror(fd)) { > rc = Fread(pkt, sizeof(*pkt), pktlen, fd); > (void) Fclose(fd); >@@ -292,7 +292,7 @@ static int makeHDRSignature(Header sigh, const char * file, > char * fn = NULL; > int ret = -1; /* assume failure. */ > >- fd = Fopen(file, "r.fdio"); >+ fd = Fopen(file, "re.fdio"); > if (fd == NULL || Ferror(fd)) > goto exit; > h = headerRead(fd, HEADER_MAGIC_YES); >@@ -418,7 +418,7 @@ static int rpmSign(const char *rpm, int deleting, const char *passPhrase) > > fprintf(stdout, "%s:\n", rpm); > >- if (manageFile(&fd, rpm, O_RDONLY)) >+ if (manageFile(&fd, rpm, O_RDONLY | O_CLOEXEC)) > goto exit; > > if ((rc = rpmLeadRead(fd, &lead, NULL, &msg)) != RPMRC_OK) { >diff --git a/tools/debugedit.c b/tools/debugedit.c >index 8dfc36a..afed611 100644 >--- a/tools/debugedit.c >+++ b/tools/debugedit.c >@@ -1557,7 +1557,7 @@ main (int argc, char *argv[]) > > if (list_file != NULL) > { >- list_file_fd = open (list_file, O_WRONLY|O_CREAT|O_APPEND, 0644); >+ list_file_fd = open (list_file, O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0644); > } > > file = args[0]; >@@ -1577,7 +1577,7 @@ main (int argc, char *argv[]) > /* Make sure we can read and write */ > chmod (file, stat_buf.st_mode | S_IRUSR | S_IWUSR); > >- fd = open (file, O_RDWR); >+ fd = open (file, O_RDWR | O_CLOEXEC); > if (fd < 0) > { > fprintf (stderr, "Failed to open input file '%s': %s\n", file, strerror(errno)); >diff --git a/tools/elfdeps.c b/tools/elfdeps.c >index f391b7f..4520d6a 100644 >--- a/tools/elfdeps.c >+++ b/tools/elfdeps.c >@@ -250,7 +250,7 @@ static int processFile(const char *fn, int dtype) > GElf_Ehdr *ehdr, ehdr_mem; > elfInfo *ei = rcalloc(1, sizeof(*ei)); > >- fdno = open(fn, O_RDONLY); >+ fdno = open(fn, O_RDONLY | O_CLOEXEC); > if (fdno < 0 || fstat(fdno, &st) < 0) > goto exit; > >diff --git a/tools/rpmgraph.c b/tools/rpmgraph.c >index 57d2eda..d4b8d4c 100644 >--- a/tools/rpmgraph.c >+++ b/tools/rpmgraph.c >@@ -87,7 +87,7 @@ restart: > (void) urlPath(*fnp, &fileName); > > /* Try to read the header from a package file. */ >- fd = Fopen(*fnp, "r.ufdio"); >+ fd = Fopen(*fnp, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), *fnp, > Fstrerror(fd)); >@@ -124,7 +124,7 @@ restart: > > maybe_manifest: > /* Try to read a package manifest. */ >- fd = Fopen(*fnp, "r.ufdio"); >+ fd = Fopen(*fnp, "re.ufdio"); > if (fd == NULL || Ferror(fd)) { > rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), *fnp, > Fstrerror(fd)); >diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c >index 8e45abf..56ea118 100644 >--- a/tools/sepdebugcrcfix.c >+++ b/tools/sepdebugcrcfix.c >@@ -128,7 +128,7 @@ crc32 (const char *fname, const char *base_fname, uint32_t *crcp) > if (asprintf (&debugname, "%s/%s/%s", usr_lib_debug, reldir, fname) <= 0) > error (1, 0, _("out of memory")); > free (reldir); >- int fd = open (debugname, O_RDONLY); >+ int fd = open (debugname, O_RDONLY | O_CLOEXEC); > if (fd == -1) > { > error (0, errno, _("cannot open \"%s\""), debugname); >@@ -302,7 +302,7 @@ main (int argc, char **argv) > for (int argi = 2; argi < argc; argi++) > { > const char *fname = argv[argi]; >- int fd = open64 (fname, O_RDWR); >+ int fd = open64 (fname, O_RDWR | O_CLOEXEC); > if (fd == -1) > { > error (0, errno, _("cannot open \"%s\""), fname); >-- >1.8.4.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 919801
:
749536
|
749537
| 833223