Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/231149a339d3
branches:  trunk
changeset: 472076:231149a339d3
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Apr 20 08:05:51 1999 +0000

description:
use mkstemp.

diffstat:

 usr.bin/m4/eval.c |  15 +++++++++++----
 usr.bin/m4/main.c |  11 ++++++++---
 2 files changed, 19 insertions(+), 7 deletions(-)

diffs (75 lines):

diff -r 1b53e039934c -r 231149a339d3 usr.bin/m4/eval.c
--- a/usr.bin/m4/eval.c Tue Apr 20 07:53:02 1999 +0000
+++ b/usr.bin/m4/eval.c Tue Apr 20 08:05:51 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eval.c,v 1.10 1997/10/19 04:39:51 lukem Exp $  */
+/*     $NetBSD: eval.c,v 1.11 1999/04/20 08:05:51 mrg Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c     8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.10 1997/10/19 04:39:51 lukem Exp $");
+__RCSID("$NetBSD: eval.c,v 1.11 1999/04/20 08:05:51 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -296,8 +296,15 @@
        /*
         * dotemp - create a temporary file
         */
-               if (argc > 2)
-                       pbstr(mktemp(argv[2]));
+               if (argc > 2) {
+                       int fd;
+
+                       fd = mkstemp(argv[2]);
+                       if (fd == -1)
+                               err(1, "mkstemp failed");
+                       close(fd);
+                       pbstr(argv[2]);
+               }
                break;
 
        case TRNLTYPE:
diff -r 1b53e039934c -r 231149a339d3 usr.bin/m4/main.c
--- a/usr.bin/m4/main.c Tue Apr 20 07:53:02 1999 +0000
+++ b/usr.bin/m4/main.c Tue Apr 20 08:05:51 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.20 1998/12/19 19:54:26 christos Exp $       */
+/*     $NetBSD: main.c,v 1.21 1999/04/20 08:05:52 mrg Exp $    */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.20 1998/12/19 19:54:26 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 1999/04/20 08:05:52 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -157,6 +157,7 @@
 {
        int c;
        int n;
+       int fd;
        char *p;
        FILE *ifp;
 
@@ -191,7 +192,11 @@
 
        active = stdout;                /* default active output     */
                                        /* filename for diversions   */
-       m4temp = mktemp(xstrdup(_PATH_DIVNAME));
+       m4temp = xstrdup(_PATH_DIVNAME);
+       fd = mkstemp(m4temp);
+       if (fd == -1)
+               err(1, "mkstemp failed");
+       close(fd);
 
        bbase[0] = bufbase;
         if (!argc) {



Home | Main Index | Thread Index | Old Index