diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-11 09:05:05 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-11 09:05:05 +0300 |
commit | fde961e25b09806e501dd214059ced1b07c1b49c (patch) | |
tree | fcfb9e33070c61a9448f6ff9bcb1fa372369763b /lib/psm.c | |
parent | 48ff62a5291458ed1181cd6c31dcadb193ad2f8e (diff) | |
download | rpm-fde961e25b09806e501dd214059ced1b07c1b49c.tar.gz rpm-fde961e25b09806e501dd214059ced1b07c1b49c.tar.bz2 rpm-fde961e25b09806e501dd214059ced1b07c1b49c.zip |
Rewrite rpmMkTempFile() for sanity
- Actually use mkstemp() for creating the temp file and return a FD_t
dupped from the file descriptor returned by mkstemp().
- Simplify the interface while at it.
- Change callers for the new interface.
- Yes we now require mkstemp() to work, mkstemp() is in POSIX.1-2001 and
this is year 2008...
Diffstat (limited to 'lib/psm.c')
-rw-r--r-- | lib/psm.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -10,7 +10,7 @@ #include <rpm/rpmurl.h> #include <rpm/rpmds.h> #include <rpm/rpmts.h> -#include <rpm/rpmfileutil.h> /* rpmMkTempFile() */ +#include <rpm/rpmfileutil.h> /* rpmMkTemp() */ #include <rpm/rpmdb.h> /* XXX for db_chrootDone */ #include <rpm/rpmlog.h> #include <rpm/rpmstring.h> @@ -696,7 +696,8 @@ static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, const char * rootDir = rpmtsRootDir(ts); FD_t fd; - if (rpmMkTempFile((!rpmtsChrootDone(ts) ? rootDir : "/"), &fn, &fd)) { + fd = rpmMkTemp((!rpmtsChrootDone(ts) ? rootDir : "/"), &fn); + if (fd == NULL || Ferror(fd)) { if (prefixes != NULL && freePrefixes) free(prefixes); return RPMRC_FAIL; } |