diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-01 20:40:30 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-01 20:40:30 +0000 |
commit | 94d8c6b4962348804e34317f5cf1d68113ef575b (patch) | |
tree | bcccc97d1c9888347278dc1e54cb1ac7f93b1146 /usr.bin/m4 | |
parent | 8f769ee1f795ed9be48cb4147e5c55b6a606d8ba (diff) |
undo mktemp cleanup until i get it right
Diffstat (limited to 'usr.bin/m4')
-rw-r--r-- | usr.bin/m4/eval.c | 13 | ||||
-rw-r--r-- | usr.bin/m4/misc.c | 14 | ||||
-rw-r--r-- | usr.bin/m4/serv.c | 12 |
3 files changed, 10 insertions, 29 deletions
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 2a5b8594941..ef14aa34604 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.4 1996/06/26 05:36:11 deraadt Exp $ */ +/* $OpenBSD: eval.c,v 1.5 1996/07/01 20:40:27 deraadt Exp $ */ /* $NetBSD: eval.c,v 1.5 1996/01/13 23:25:23 pk Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: eval.c,v 1.4 1996/06/26 05:36:11 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: eval.c,v 1.5 1996/07/01 20:40:27 deraadt Exp $"; #endif #endif /* not lint */ @@ -52,7 +52,6 @@ static char rcsid[] = "$OpenBSD: eval.c,v 1.4 1996/06/26 05:36:11 deraadt Exp $" */ #include <sys/types.h> -#include <sys/file.h> #include <errno.h> #include <unistd.h> #include <stdio.h> @@ -665,18 +664,12 @@ void dodiv(n) register int n; { - int fd; - if (n < 0 || n >= MAXOUT) n = 0; /* bitbucket */ if (outfile[n] == NULL) { m4temp[UNIQUE] = n + '0'; - if ((fd = open(m4temp, O_RDWR|O_EXCL|O_CREAT, 0666)) == -1 || - (outfile[n] = fdopen(fd, "w")) == NULL) { - if (fd != -1) - close(fd); + if ((outfile[n] = fopen(m4temp, "w")) == NULL) oops("%s: cannot divert.", m4temp); - } } oindex = n; active = outfile[n]; diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c index 1b161f1c393..da514c1fe60 100644 --- a/usr.bin/m4/misc.c +++ b/usr.bin/m4/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.3 1996/06/26 05:36:15 deraadt Exp $ */ +/* $OpenBSD: misc.c,v 1.4 1996/07/01 20:40:28 deraadt Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /* @@ -41,12 +41,11 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: misc.c,v 1.3 1996/06/26 05:36:15 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.4 1996/07/01 20:40:28 deraadt Exp $"; #endif #endif /* not lint */ #include <sys/types.h> -#include <sys/file.h> #include <errno.h> #include <unistd.h> #include <stdio.h> @@ -155,20 +154,15 @@ int n; { register int c; register FILE *dfil; - int fd; if (active == outfile[n]) oops("%s: diversion still active.", "undivert"); (void) fclose(outfile[n]); outfile[n] = NULL; m4temp[UNIQUE] = n + '0'; - - if ((fd = open(m4temp, O_RDWR|O_EXCL|O_CREAT, 0666)) == -1 || - (dfil = fdopen(fd, "r")) == NULL) { - if (fd != -1) - close(fd); + if ((dfil = fopen(m4temp, "r")) == NULL) oops("%s: cannot undivert.", m4temp); - } else + else while ((c = getc(dfil)) != EOF) putc(c, active); (void) fclose(dfil); diff --git a/usr.bin/m4/serv.c b/usr.bin/m4/serv.c index f264a550ef4..e423c5987d2 100644 --- a/usr.bin/m4/serv.c +++ b/usr.bin/m4/serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: serv.c,v 1.3 1996/06/26 05:36:16 deraadt Exp $ */ +/* $OpenBSD: serv.c,v 1.4 1996/07/01 20:40:29 deraadt Exp $ */ /* $NetBSD: serv.c,v 1.7 1995/09/28 05:37:47 tls Exp $ */ /* @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)serv.c 5.4 (Berkeley) 1/21/94"; #else -static char rcsid[] = "$OpenBSD: serv.c,v 1.3 1996/06/26 05:36:16 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: serv.c,v 1.4 1996/07/01 20:40:29 deraadt Exp $"; #endif #endif /* not lint */ @@ -337,18 +337,12 @@ register int argc; dodiv(n) register int n; { - int fd; - if (n < 0 || n >= MAXOUT) n = 0; /* bitbucket */ if (outfile[n] == NULL) { m4temp[UNIQUE] = n + '0'; - if ((fd = open(m4temp, O_RDWR|O_EXECL|O_CREAT, 0666)) == -1 || - (outfile[n] = fdopen(fd, "w")) == NULL) { - if (fd != -1) - close(fd); + if ((outfile[n] = fopen(m4temp, "w")) == NULL) error("m4: cannot divert."); - } } oindex = n; active = outfile[n]; |