summaryrefslogtreecommitdiff
path: root/build.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-12-26 17:36:38 +0000
committerjbj <devnull@localhost>2003-12-26 17:36:38 +0000
commit5c747d9870d80aa0213f325bc03e22f081749b0d (patch)
tree1a6cc29f0eccb663b533c9d96479da447e2d2885 /build.c
parent32c0cfd728a123e5c594e540d1a2aeef67895709 (diff)
downloadrpm-5c747d9870d80aa0213f325bc03e22f081749b0d.tar.gz
rpm-5c747d9870d80aa0213f325bc03e22f081749b0d.tar.bz2
rpm-5c747d9870d80aa0213f325bc03e22f081749b0d.zip
- don't use mktemp if mkstemp is available (#103850).
CVS patchset: 7012 CVS date: 2003/12/26 17:36:38
Diffstat (limited to 'build.c')
-rw-r--r--build.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/build.c b/build.c
index fb32018d6..fc9df11c1 100644
--- a/build.c
+++ b/build.c
@@ -126,7 +126,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
if (ba->buildMode == 't') {
FILE *fp;
const char * specDir;
- const char * tmpSpecFile;
+ char * tmpSpecFile;
char * cmd, * s;
rpmCompressedMagic res = COMPRESSED_OTHER;
/*@observer@*/ static const char *zcmds[] =
@@ -134,14 +134,12 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
specDir = rpmGetPath("%{_specdir}", NULL);
- /* XXX Using mkstemp is difficult here. */
- /* XXX FWIW, default %{_specdir} is root.root 0755 */
- { char tfn[64];
- strcpy(tfn, "rpm-spec.XXXXXX");
- /*@-unrecog@*/
- tmpSpecFile = rpmGetPath("%{_specdir}/", mktemp(tfn), NULL);
- /*@=unrecog@*/
- }
+ tmpSpecFile = rpmGetPath("%{_specdir}/", "rpm-spec.XXXXXX", NULL);
+#if defined(HAVE_MKSTEMP)
+ (void) close(mkstemp(tmpSpecFile));
+#else
+ (void) mktemp(tmpSpecFile);
+#endif
(void) isCompressed(arg, &res);