Module Name:    src
Committed By:   sjg
Date:           Fri Feb  5 22:15:44 UTC 2021

Modified Files:
        src/usr.bin/make: job.c

Log Message:
Job_TempFile: unlink while signals blocked


To generate a diff of this commit:
cvs rdiff -u -r1.419 -r1.420 src/usr.bin/make/job.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.419 src/usr.bin/make/job.c:1.420
--- src/usr.bin/make/job.c:1.419	Fri Feb  5 19:19:17 2021
+++ src/usr.bin/make/job.c	Fri Feb  5 22:15:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.419 2021/02/05 19:19:17 sjg Exp $	*/
+/*	$NetBSD: job.c,v 1.420 2021/02/05 22:15:44 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.419 2021/02/05 19:19:17 sjg Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.420 2021/02/05 22:15:44 sjg Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1582,8 +1582,6 @@ JobWriteShellCommands(Job *job, GNode *g
 	}
 
 	tfd = Job_TempFile(TMPPAT, tfile, sizeof tfile);
-	if (!DEBUG(SCRIPT))
-	    eunlink(tfile);
 
 	job->cmdFILE = fdopen(tfd, "w+");
 	if (job->cmdFILE == NULL)
@@ -2768,6 +2766,8 @@ Job_TempFile(const char *pattern, char *
 
 	JobSigLock(&mask);
 	fd = mkTempFile(pattern, tfile, tfile_sz);
+	if (tfile != NULL && !DEBUG(SCRIPT))
+	    unlink(tfile);
 	JobSigUnlock(&mask);
 
 	return fd;

Reply via email to