Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jan 2000 17:08:34 -0800 (PST)
From:      Kris Kennaway <kris@hub.freebsd.org>
To:        audit@freebsd.org
Subject:   awk tempfile handling
Message-ID:  <Pine.BSF.4.21.0001161707440.18027-100000@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Index: io.c
===================================================================
RCS file: /home/ncvs/src/contrib/awk/io.c,v
retrieving revision 1.4
diff -u -r1.4 io.c
--- io.c	1999/09/27 08:56:57	1.4
+++ io.c	2000/01/13 03:50:36
@@ -1170,16 +1170,14 @@
 {
 	extern char *strdup P((const char *));
 	int current;
-	char *name;
+	char *name = "/tmp/pipXXXXXXXXXX";
 	static char cmdbuf[256];
 
 	/* get a name to use */
-	if ((name = tempnam(".", "pip")) == NULL)
+	if ((current = mkstemp(name)) == INVALID_HANDLE)
 		return NULL;
 	sprintf(cmdbuf, "%s > %s", cmd, name);
 	system(cmdbuf);
-	if ((current = open(name, O_RDONLY)) == INVALID_HANDLE)
-		return NULL;
 	pipes[current].name = name;
 	pipes[current].command = strdup(cmd);
 	rp->iop = iop_alloc(current, name, NULL);

----
"How many roads must a man walk down, before you call him a man?"
"Eight!"
"That was a rhetorical question!"
"Oh..then, seven!" -- Homer Simpson



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0001161707440.18027-100000>