From 22dca23d52c836e40c79cb4042b867fdc06f6ca3 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 3 Sep 2006 14:23:29 +0000 Subject: archival: added O_TRUNC so that when we overwrite files on unpack, we truncate them. Also spotted & fixed hard to trigger bug with extension handling. --- archival/uncompress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'archival/uncompress.c') diff --git a/archival/uncompress.c b/archival/uncompress.c index ca775c787..8c466ebdf 100644 --- a/archival/uncompress.c +++ b/archival/uncompress.c @@ -55,7 +55,8 @@ int uncompress_main(int argc, char **argv) /* Open output file */ xstat(compressed_file, &stat_buf); - dst_fd = xopen3(uncompressed_file, O_WRONLY | O_CREAT, + dst_fd = xopen3(uncompressed_file, + O_WRONLY | O_CREAT | O_TRUNC, stat_buf.st_mode); /* If unzip succeeds remove the old file */ -- cgit v1.2.3