summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-05-11 21:37:13 +0000
committermillert <millert@openbsd.org>2002-05-11 21:37:13 +0000
commitb58e5ef586076a7e92245c1780e4fd3049531d0e (patch)
tree0c51a419b37ca4141ae06d90fac989e0a52aacce
parenttypo in comment (diff)
downloadwireguard-openbsd-b58e5ef586076a7e92245c1780e4fd3049531d0e.tar.xz
wireguard-openbsd-b58e5ef586076a7e92245c1780e4fd3049531d0e.zip
Use O_EXCL (not O_TRUNC) when creating new job file. If there is a
pre-existing file with the same name this is indicative of a problem with the sequence file and so it makes sense to treat it as an error.
-rw-r--r--usr.bin/at/at.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index 2ee77b8d51c..00a2329575f 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.22 2002/05/11 18:41:20 millert Exp $ */
+/* $OpenBSD: at.c,v 1.23 2002/05/11 21:37:13 millert Exp $ */
/* $NetBSD: at.c,v 1.4 1995/03/25 18:13:31 glass Exp $ */
/*
@@ -74,7 +74,7 @@ enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */
/* File scope variables */
#ifndef lint
-static char rcsid[] = "$OpenBSD: at.c,v 1.22 2002/05/11 18:41:20 millert Exp $";
+static char rcsid[] = "$OpenBSD: at.c,v 1.23 2002/05/11 21:37:13 millert Exp $";
#endif
char *no_export[] =
@@ -253,8 +253,7 @@ writefile(runtimer, queue)
* their r bit. Yes, this is a kluge.
*/
cmask = umask(S_IRUSR | S_IWUSR | S_IXUSR);
- if ((fdes = open(atfile, O_WRONLY|O_CREAT|O_TRUNC|O_NONBLOCK|O_NOFOLLOW,
- S_IRUSR)) == -1)
+ if ((fdes = open(atfile, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR)) == -1)
perr("Cannot create atjob file");
if ((fd2 = dup(fdes)) < 0)