diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-25 00:26:03 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-25 00:26:03 +0000 |
commit | b6fce69f88688e4548ce7980e1c50b05a7e8087d (patch) | |
tree | a02630f771fbde4042adcf247477537a6bdb1116 /bin/ed | |
parent | 0fed21e1e3863944ca07c6d32cd8a6f07ee15be2 (diff) |
mkstemp
Diffstat (limited to 'bin/ed')
-rw-r--r-- | bin/ed/buf.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/bin/ed/buf.c b/bin/ed/buf.c index e5cbe441ac0..67f57e77d7f 100644 --- a/bin/ed/buf.c +++ b/bin/ed/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.3 1996/06/24 21:13:50 deraadt Exp $ */ +/* $OpenBSD: buf.c,v 1.4 1996/06/25 00:26:02 deraadt Exp $ */ /* $NetBSD: buf.c,v 1.15 1995/04/23 10:07:28 cgd Exp $ */ /* buf.c: This file contains the scratch-file buffer rountines for the @@ -33,7 +33,7 @@ #if 0 static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp"; #else -static char rcsid[] = "$OpenBSD: buf.c,v 1.3 1996/06/24 21:13:50 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: buf.c,v 1.4 1996/06/25 00:26:02 deraadt Exp $"; #endif #endif /* not lint */ @@ -210,8 +210,7 @@ open_sbuf() isbinary = newline_added = 0; u = umask(077); strcpy(sfn, "/tmp/ed.XXXXXX"); - if (mktemp(sfn) == NULL || - (fd = open(sfn, O_RDWR|O_CREAT|O_EXCL, 0666)) == -1 || + if ((fd = mkstemp(sfn)) == -1 || (sfp = fdopen(fd, "w+")) == NULL) { if (fd != -1) close(fd); |