aboutsummaryrefslogtreecommitdiff
path: root/archival/gunzip.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-03 14:23:29 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-03 14:23:29 +0000
commit22dca23d52c836e40c79cb4042b867fdc06f6ca3 (patch)
treea9f7e6c318e749875288358c963d53c25fab681a /archival/gunzip.c
parent314908da9e156e3100275598dde6848da038d65d (diff)
downloadbusybox-w32-22dca23d52c836e40c79cb4042b867fdc06f6ca3.tar.gz
busybox-w32-22dca23d52c836e40c79cb4042b867fdc06f6ca3.tar.bz2
busybox-w32-22dca23d52c836e40c79cb4042b867fdc06f6ca3.zip
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.
Diffstat (limited to 'archival/gunzip.c')
-rw-r--r--archival/gunzip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 3a1d1cb61..7be94e1b8 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -98,7 +98,8 @@ int gunzip_main(int argc, char **argv)
98 } 98 }
99 99
100 /* Open output file (with correct permissions) */ 100 /* Open output file (with correct permissions) */
101 dst_fd = xopen3(new_path, O_WRONLY | O_CREAT, stat_buf.st_mode); 101 dst_fd = xopen3(new_path, O_WRONLY | O_CREAT | O_TRUNC,
102 stat_buf.st_mode);
102 103
103 /* If unzip succeeds remove the old file */ 104 /* If unzip succeeds remove the old file */
104 delete_path = old_path; 105 delete_path = old_path;