diff options
author | 1996-07-30 20:34:54 +0000 | |
---|---|---|
committer | 1996-07-30 20:34:54 +0000 | |
commit | 1f64d87abacb9048ed5782e6c9b1fbe8e3f54352 (patch) | |
tree | 4ad204504e98f6d4b7abe543d68ccfb26b2e6131 | |
parent | Cleanup of abi call and endian stuff. Also fixed some bugs. (AENT). (diff) | |
download | wireguard-openbsd-1f64d87abacb9048ed5782e6c9b1fbe8e3f54352.tar.xz wireguard-openbsd-1f64d87abacb9048ed5782e6c9b1fbe8e3f54352.zip |
use mkstemp() instead of mktemp() to close temp file race.
-rw-r--r-- | usr.bin/oldrdist/docmd.c | 8 | ||||
-rw-r--r-- | usr.bin/oldrdist/main.c | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/oldrdist/docmd.c b/usr.bin/oldrdist/docmd.c index e2e28a9645c..4a179792b46 100644 --- a/usr.bin/oldrdist/docmd.c +++ b/usr.bin/oldrdist/docmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: docmd.c,v 1.5 1996/07/25 05:13:47 millert Exp $ */ +/* $OpenBSD: docmd.c,v 1.6 1996/07/30 20:34:54 millert Exp $ */ /* * Copyright (c) 1983, 1993 @@ -35,7 +35,7 @@ #ifndef lint /* from: static char sccsid[] = "@(#)docmd.c 8.1 (Berkeley) 6/9/93"; */ -static char *rcsid = "$OpenBSD: docmd.c,v 1.5 1996/07/25 05:13:47 millert Exp $"; +static char *rcsid = "$OpenBSD: docmd.c,v 1.6 1996/07/30 20:34:54 millert Exp $"; #endif /* not lint */ #include "defs.h" @@ -148,7 +148,7 @@ doarrow(filev, files, rhost, cmds) signal(SIGPIPE, lostconn); if (!makeconn(rhost)) return; - if ((fd = open(tempfile, O_RDWR|O_EXCL|O_CREAT, 0666)) == -1 || + if ((fd = mkstemp(tempfile)) == -1 || (lfp = fdopen(fd, "w")) == NULL) { if (fd != -1) close(fd); @@ -399,7 +399,7 @@ dodcolon(filev, files, stamp, cmds) else { int fd; - if ((fd = open(tempfile, O_RDWR|O_EXCL|O_CREAT, 0666)) == -1 || + if ((fd = mkstemp(tempfile)) == -1 || (tfp = fdopen(fd, "w")) == NULL) { if (fd != -1) close(fd); diff --git a/usr.bin/oldrdist/main.c b/usr.bin/oldrdist/main.c index ab1679d6a17..cb6960b15b4 100644 --- a/usr.bin/oldrdist/main.c +++ b/usr.bin/oldrdist/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.3 1996/07/19 21:57:33 millert Exp $ */ +/* $OpenBSD: main.c,v 1.4 1996/07/30 20:34:55 millert Exp $ */ /* * Copyright (c) 1983, 1993 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/9/93"; */ -static char *rcsid = "$OpenBSD: main.c,v 1.3 1996/07/19 21:57:33 millert Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.4 1996/07/30 20:34:55 millert Exp $"; #endif /* not lint */ #include "defs.h" @@ -197,7 +197,6 @@ main(argc, argv) exit(1); } #endif /* DIRECT_RCMD */ - mktemp(tempfile); if (iamremote) { server(); |