diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-03-15 06:06:00 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-03-15 06:06:00 +0000 |
commit | 741afbe21c60e1763b21849a6ede38cfdaf1f848 (patch) | |
tree | 8529bb52facb8bcb8d98975c7575a0c7c5925070 /bin/pax | |
parent | 7dbf7e2ad88093360226c21556e1c5d4d894391c (diff) |
Using O_TRUNC with O_CREAT|O_EXCL is just confusing: fail if it exists,
but if you *did* succeed anyway, truncate it?
Diffstat (limited to 'bin/pax')
-rw-r--r-- | bin/pax/file_subs.c | 4 |
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); |