summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2010-07-28 23:52:01 +0000
committermillert <millert@openbsd.org>2010-07-28 23:52:01 +0000
commite74aaf646940f2e6b792fa7e5e7c71453591a22b (patch)
tree55e50cb82d7f2d6372049b0a1d8a6eb62d57dc78
parentDVD_INVALIDATE_AGID is a 'no payload' operation, so don't set (diff)
downloadwireguard-openbsd-e74aaf646940f2e6b792fa7e5e7c71453591a22b.tar.xz
wireguard-openbsd-e74aaf646940f2e6b792fa7e5e7c71453591a22b.zip
Truncate output file when compressing. OK deraadt@
-rw-r--r--usr.bin/compress/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/compress/main.c b/usr.bin/compress/main.c
index fc52a90935e..a7447b03dc4 100644
--- a/usr.bin/compress/main.c
+++ b/usr.bin/compress/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.75 2009/04/18 18:21:54 naddy Exp $ */
+/* $OpenBSD: main.c,v 1.76 2010/07/28 23:52:01 millert Exp $ */
#ifndef SMALL
static const char copyright[] =
@@ -36,7 +36,7 @@ static const char license[] =
#endif /* SMALL */
#ifndef SMALL
-static const char main_rcsid[] = "$OpenBSD: main.c,v 1.75 2009/04/18 18:21:54 naddy Exp $";
+static const char main_rcsid[] = "$OpenBSD: main.c,v 1.76 2010/07/28 23:52:01 millert Exp $";
#endif
#include <sys/param.h>
@@ -482,7 +482,7 @@ docompress(const char *in, char *out, const struct compressor *method,
return (WARNING);
}
}
- ofd = open(out, O_WRONLY|O_CREAT, S_IWUSR);
+ ofd = open(out, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR);
}
if (ofd < 0) {
if (verbose >= 0)