From b6fce69f88688e4548ce7980e1c50b05a7e8087d Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 25 Jun 1996 00:26:03 +0000 Subject: mkstemp --- bin/ed/buf.c | 7 +++---- 1 file 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); -- cgit v1.2.3