summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);