From owner-freebsd-audit Sun Jan 16 17: 8:35 2000 Delivered-To: freebsd-audit@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 758) id 6A04B14D98; Sun, 16 Jan 2000 17:08:34 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 5E61E1CD5C9 for ; Sun, 16 Jan 2000 17:08:34 -0800 (PST) (envelope-from kris@hub.freebsd.org) Date: Sun, 16 Jan 2000 17:08:34 -0800 (PST) From: Kris Kennaway To: audit@freebsd.org Subject: awk tempfile handling Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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