Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xstr use mkstemp



details:   https://anonhg.NetBSD.org/src/rev/4121bbed3029
branches:  trunk
changeset: 472081:4121bbed3029
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Apr 20 13:53:53 1999 +0000

description:
use mkstemp

diffstat:

 usr.bin/xstr/xstr.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r c25c465f9435 -r 4121bbed3029 usr.bin/xstr/xstr.c
--- a/usr.bin/xstr/xstr.c       Tue Apr 20 13:52:36 1999 +0000
+++ b/usr.bin/xstr/xstr.c       Tue Apr 20 13:53:53 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xstr.c,v 1.9 1998/12/20 19:13:19 christos Exp $        */
+/*     $NetBSD: xstr.c,v 1.10 1999/04/20 13:53:53 mrg Exp $    */
 
 /*
  * Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)xstr.c     8.1 (Berkeley) 6/9/93";
 #else
-__RCSID("$NetBSD: xstr.c,v 1.9 1998/12/20 19:13:19 christos Exp $");
+__RCSID("$NetBSD: xstr.c,v 1.10 1999/04/20 13:53:53 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,8 +135,15 @@
                (void)signal(SIGINT, onintr);
        if (cflg || (argc == 0 && !readstd))
                inithash();
-       else
-               strings = mktemp(strdup(_PATH_TMP));
+       else {
+               int     fd;
+
+               strings = strdup(_PATH_TMP);
+               fd = mkstemp(strings);
+               if (fd == -1)
+                       err(1, "mkstemp failed");
+               close(fd);
+       }
        while (readstd || argc > 0) {
                if (freopen("x.c", "w", stdout) == NULL)
                        err(1, "Cannot open `%s'", "x.c");



Home | Main Index | Thread Index | Old Index