Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): clean up mkTempFile
details: https://anonhg.NetBSD.org/src/rev/1471b8234cb7
branches: trunk
changeset: 956462:1471b8234cb7
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Oct 31 09:20:07 2020 +0000
description:
make(1): clean up mkTempFile
diffstat:
usr.bin/make/main.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (53 lines):
diff -r 4bc634006330 -r 1471b8234cb7 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sat Oct 31 09:03:36 2020 +0000
+++ b/usr.bin/make/main.c Sat Oct 31 09:20:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.413 2020/10/31 06:18:21 sjg Exp $ */
+/* $NetBSD: main.c,v 1.414 2020/10/31 09:20:07 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.413 2020/10/31 06:18:21 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.414 2020/10/31 09:20:07 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -2169,19 +2169,19 @@
/*
* Create and open a temp file using "pattern".
- * If "fnamep" is provided set it to a copy of the filename created.
+ * If out_fname is provided, set it to a copy of the filename created.
* Otherwise unlink the file once open.
*/
int
-mkTempFile(const char *pattern, char **fnamep)
+mkTempFile(const char *pattern, char **out_fname)
{
static char *tmpdir = NULL;
char tfile[MAXPATHLEN];
int fd;
- if (!pattern)
+ if (pattern != NULL)
pattern = TMPPAT;
- if (!tmpdir)
+ if (tmpdir == NULL)
tmpdir = getTmpdir();
if (pattern[0] == '/') {
snprintf(tfile, sizeof(tfile), "%s", pattern);
@@ -2190,8 +2190,8 @@
}
if ((fd = mkstemp(tfile)) < 0)
Punt("Could not create temporary file %s: %s", tfile, strerror(errno));
- if (fnamep) {
- *fnamep = bmake_strdup(tfile);
+ if (out_fname) {
+ *out_fname = bmake_strdup(tfile);
} else {
unlink(tfile); /* we just want the descriptor */
}
Home |
Main Index |
Thread Index |
Old Index