diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-23 10:54:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-23 10:54:23 +0000 |
commit | d39691df26224dd4802b69c04a38d501cd26b595 (patch) | |
tree | 83f25ab813670c0fe864c2f973af18b464dc2ab3 /usr.bin | |
parent | 35fcd59ab7d5e77c7a61c3e76b92fa873b6047f9 (diff) |
undo last; mkstemp is *hard* to do in here
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/patch/patch.c | 16 | ||||
-rw-r--r-- | usr.bin/patch/pch.c | 10 |
2 files changed, 10 insertions, 16 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index afb9b7307a6..9ad408495da 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.5 1996/09/15 19:19:54 millert Exp $ */ +/* $OpenBSD: patch.c,v 1.6 1996/09/23 10:54:21 deraadt Exp $ */ /* patch - a program to apply diffs to original files * @@ -9,7 +9,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: patch.c,v 1.5 1996/09/15 19:19:54 millert Exp $"; +static char rcsid[] = "$OpenBSD: patch.c,v 1.6 1996/09/23 10:54:21 deraadt Exp $"; #endif /* not lint */ #include "INTERN.h" @@ -784,10 +784,8 @@ void init_output(name) char *name; { - int ofd; - - if ((ofd = open(name, O_CREAT|O_EXCL|O_WRONLY, 0600)) < 0 || - (ofp = fdopen(ofd, "w")) == Nullfp) + ofp = fopen(name, "w"); + if (ofp == Nullfp) pfatal2("can't create %s", name); } @@ -797,10 +795,8 @@ void init_reject(name) char *name; { - int rejfd; - - if ((rejfd = open(name, O_CREAT|O_EXCL|O_WRONLY, 0600)) < 0 || - (rejfp = fdopen(rejfd, "w")) == Nullfp) + rejfp = fopen(name, "w"); + if (rejfp == Nullfp) pfatal2("can't create %s", name); } diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 33fbb2ec3aa..ece445ed578 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: pch.c,v 1.5 1996/09/15 19:19:52 millert Exp $ */ +/* $OpenBSD: pch.c,v 1.6 1996/09/23 10:54:22 deraadt Exp $ */ #ifndef lint -static char rcsid[] = "$OpenBSD: pch.c,v 1.5 1996/09/15 19:19:52 millert Exp $"; +static char rcsid[] = "$OpenBSD: pch.c,v 1.6 1996/09/23 10:54:22 deraadt Exp $"; #endif /* not lint */ #include "EXTERN.h" @@ -55,10 +55,8 @@ open_patch_file(filename) char *filename; { if (filename == Nullch || !*filename || strEQ(filename, "-")) { - int pfd; - - if ((pfd = open(TMPPATNAME, O_CREAT|O_EXCL|O_WRONLY, 0600)) < 0 || - (pfp = fdopen(pfd, "w")) == Nullfp) + pfp = fopen(TMPPATNAME, "w"); + if (pfp == Nullfp) pfatal2("can't create %s", TMPPATNAME); while (fgets(buf, sizeof buf, stdin) != Nullch) fputs(buf, pfp); |