diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1997-12-10 05:02:03 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1997-12-10 05:02:03 +0000 |
commit | 7a9ccd7b73617e3914930889a569e5bc66b6c587 (patch) | |
tree | 4425f8c3a7b253c2dca23aa8dc7d574b13b59b5b /sbin/scsi/scsi.c | |
parent | af991b2c4f5096b23bdd8d577c3993f636129aa3 (diff) |
Fix tmpnam()...i don't have SCSI though, so i couldn't test.
Diffstat (limited to 'sbin/scsi/scsi.c')
-rw-r--r-- | sbin/scsi/scsi.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sbin/scsi/scsi.c b/sbin/scsi/scsi.c index 946875d40a3..a23192e71f8 100644 --- a/sbin/scsi/scsi.c +++ b/sbin/scsi/scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi.c,v 1.4 1997/08/26 13:38:09 niklas Exp $ */ +/* $OpenBSD: scsi.c,v 1.5 1997/12/10 05:02:02 angelos Exp $ */ /* $FreeBSD: scsi.c,v 1.11 1996/04/06 11:00:28 joerg Exp $ */ /* @@ -650,13 +650,16 @@ edit_done(void) static void edit_init(void) { + int fd; + edit_rewind(); - if (tmpnam(edit_name) == 0) { - perror("tmpnam failed"); + strcpy(edit_name, "/var/tmp/scXXXXXXXX"); + if ((fd = mkstemp(edit_name)) == -1) { + perror("mkstemp failed"); exit(errno); } - if ( (edit_file = fopen(edit_name, "w")) == 0) { - perror(edit_name); + if ( (edit_file = fdopen(fd, "w+")) == 0) { + perror("fdopen failed"); exit(errno); } edit_opened = 1; |