Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pkg_install/lib Use mkstemp instead of mkstemp.



details:   https://anonhg.NetBSD.org/src/rev/20fc6fc9f100
branches:  trunk
changeset: 481603:20fc6fc9f100
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Wed Feb 02 14:42:53 2000 +0000

description:
Use mkstemp instead of mkstemp.

diffstat:

 usr.sbin/pkg_install/lib/ftpio.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 0e8585d04f99 -r 20fc6fc9f100 usr.sbin/pkg_install/lib/ftpio.c
--- a/usr.sbin/pkg_install/lib/ftpio.c  Wed Feb 02 14:23:48 2000 +0000
+++ b/usr.sbin/pkg_install/lib/ftpio.c  Wed Feb 02 14:42:53 2000 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: ftpio.c,v 1.13 2000/02/02 14:09:40 hubertf Exp $       */
+/*     $NetBSD: ftpio.c,v 1.14 2000/02/02 14:42:53 hubertf Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.13 2000/02/02 14:09:40 hubertf Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.14 2000/02/02 14:42:53 hubertf Exp $");
 #endif
 
 /*
@@ -455,10 +455,16 @@
        char *s, buf[FILENAME_MAX];
        char tmpname[FILENAME_MAX];
        char best[FILENAME_MAX];
+       int tfd;
 
-       strcpy(tmpname, "/tmp/pkg.XXX");
-       mktemp(tmpname);
-       assert(tmpname != NULL);
+       strcpy(tmpname, "/tmp/pkg.XXXXXX");
+       tfd=mkstemp(tmpname);
+       if (tfd == -1) {
+               warnx("Cannot generate temp file for ftp(1)'s ls output");
+               return -1; /* error */
+       }
+       close(tfd); /* We don't need the file descriptor, but will use 
+                      the file in a second */
 
        s=strpbrk(pkg, "<>[]?*{"); /* Could leave out "[]?*" here;
                                    * ftp(1) is not that stupid */



Home | Main Index | Thread Index | Old Index