Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/9bbd31ad8249
branches:  trunk
changeset: 472074:9bbd31ad8249
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Apr 20 07:24:49 1999 +0000

description:
use mkstemp

diffstat:

 usr.bin/msgs/msgs.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (52 lines):

diff -r 0642c14e87e2 -r 9bbd31ad8249 usr.bin/msgs/msgs.c
--- a/usr.bin/msgs/msgs.c       Tue Apr 20 07:15:38 1999 +0000
+++ b/usr.bin/msgs/msgs.c       Tue Apr 20 07:24:49 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msgs.c,v 1.13 1998/12/19 20:08:03 christos Exp $       */
+/*     $NetBSD: msgs.c,v 1.14 1999/04/20 07:24:49 mrg Exp $    */
 
 /*-
  * Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)msgs.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: msgs.c,v 1.13 1998/12/19 20:08:03 christos Exp $");
+__RCSID("$NetBSD: msgs.c,v 1.14 1999/04/20 07:24:49 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -77,8 +77,10 @@
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+
 #include <ctype.h>
 #include <dirent.h>
+#include <err.h>
 #include <errno.h>
 #include <pwd.h>
 #include <setjmp.h>
@@ -90,6 +92,7 @@
 #include <termios.h>
 #include <time.h>
 #include <unistd.h>
+
 #include "pathnames.h"
 
 #define CMODE  0664            /* bounds file creation mode */
@@ -784,8 +787,13 @@
                                strcpy(fname, "Messages");
                }
                else {
+                       int     fd;
+
                        strcpy(fname, _PATH_TMP);
-                       mktemp(fname);
+                       fd = mkstemp(fname);
+                       if (fd == -1)
+                               err(1, "mkstemp failed");
+                       close(fd);
                        sprintf(cmdbuf, _PATH_MAIL, fname);
                        mailing = YES;
                }



Home | Main Index | Thread Index | Old Index