summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-11 09:05:05 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-11 09:05:05 +0300
commitfde961e25b09806e501dd214059ced1b07c1b49c (patch)
treefcfb9e33070c61a9448f6ff9bcb1fa372369763b /build
parent48ff62a5291458ed1181cd6c31dcadb193ad2f8e (diff)
downloadrpm-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 'build')
-rw-r--r--build/build.c3
-rw-r--r--build/pack.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/build/build.c b/build/build.c
index d89409d4e..3c6d55283 100644
--- a/build/build.c
+++ b/build/build.c
@@ -126,7 +126,8 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb,
goto exit;
}
- if (rpmMkTempFile(rootDir, &scriptName, &fd) || fd == NULL || Ferror(fd)) {
+ fd = rpmMkTemp(rootDir, &scriptName);
+ if (fd == NULL || Ferror(fd)) {
rpmlog(RPMLOG_ERR, _("Unable to open temp file.\n"));
rc = RPMRC_FAIL;
goto exit;
diff --git a/build/pack.c b/build/pack.c
index 37159a0b5..248b5747a 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -407,7 +407,8 @@ rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
* Write the header+archive into a temp file so that the size of
* archive (after compression) can be added to the header.
*/
- if (rpmMkTempFile(NULL, &sigtarget, &fd)) {
+ fd = rpmMkTemp(NULL, &sigtarget);
+ if (fd == NULL || Ferror(fd)) {
rc = RPMRC_FAIL;
rpmlog(RPMLOG_ERR, _("Unable to open temp file.\n"));
goto exit;