summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-03-15 06:05:59 +0000
committerguenther <guenther@openbsd.org>2015-03-15 06:05:59 +0000
commit217c04afe7d054c29ca66b8b75529e1486475f04 (patch)
tree18679368876705439c1b1ee62aece6066eca5e75
parentpax -o only accepts 'write_opt=nodir' and not bare 'nodir' (diff)
downloadwireguard-openbsd-217c04afe7d054c29ca66b8b75529e1486475f04.tar.xz
wireguard-openbsd-217c04afe7d054c29ca66b8b75529e1486475f04.zip
Using O_TRUNC with O_CREAT|O_EXCL is just confusing: fail if it exists,
but if you *did* succeed anyway, truncate it?
-rw-r--r--bin/pax/file_subs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c
index 393d0881ed0..4bfc2eb6907 100644
--- a/bin/pax/file_subs.c
+++ b/bin/pax/file_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file_subs.c,v 1.45 2015/03/09 04:23:29 guenther Exp $ */
+/* $OpenBSD: file_subs.c,v 1.46 2015/03/15 06:05:59 guenther Exp $ */
/* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
/*-
@@ -82,7 +82,7 @@ file_creat(ARCHD *arcn)
* first with lstat.
*/
file_mode = arcn->sb.st_mode & FILEBITS;
- if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
+ if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_EXCL,
file_mode)) >= 0)
return(fd);