summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-17 09:30:20 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-17 09:42:11 -0700
commita511600f0391e7ecc2fa55e5cda222b5535422e8 (patch)
tree8bacacf04d79a47bbcb788cbb912b0742a2b2031
parent4945a09e914c48a2a55dacdb24ffe2806378641b (diff)
Simplify HAVE_MKSTEMP block
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--imake.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/imake.c b/imake.c
index 62e73eb..c07948d 100644
--- a/imake.c
+++ b/imake.c
@@ -399,17 +399,16 @@ main(int argc, char *argv[])
if ((tmpfd = fopen(tmpMakefile, "w+")) == NULL)
LogFatal("Cannot create temporary file %s.", tmpMakefile);
} else {
-#ifdef HAVE_MKSTEMP
- int fd;
-#endif
char *tmpMakefileName = Strdup(tmpMakefileTemplate);
+
#ifndef HAVE_MKSTEMP
if (mktemp(tmpMakefileName) == NULL ||
(tmpfd = fopen(tmpMakefileName, "w+")) == NULL) {
LogFatal("Cannot create temporary file %s.", tmpMakefileName);
}
#else
- fd = mkstemp(tmpMakefileName);
+ int fd = mkstemp(tmpMakefileName);
+
if (fd == -1 || (tmpfd = fdopen(fd, "w+")) == NULL) {
if (fd != -1) {
unlink(tmpMakefileName); close(fd);