diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/bunzip2.c | 5 | ||||
-rw-r--r-- | archival/uncompress.c | 8 | ||||
-rw-r--r-- | archival/unlzma.c | 5 |
3 files changed, 5 insertions, 13 deletions
diff --git a/archival/bunzip2.c b/archival/bunzip2.c index 09364b40e..abd7db3ab 100644 --- a/archival/bunzip2.c +++ b/archival/bunzip2.c @@ -50,10 +50,7 @@ int bunzip2_main(int argc, char **argv) if (strcmp(extension, ".bz2") != 0) { bb_error_msg_and_die("Invalid extension"); } - /* TODO: xstat */ - if (stat(filename, &stat_buf) < 0) { - bb_error_msg_and_die("Couldn't stat file %s", filename); - } + xstat(filename, &stat_buf); *extension=0; dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode); } else dst_fd = STDOUT_FILENO; diff --git a/archival/uncompress.c b/archival/uncompress.c index c47436ea3..b282fe811 100644 --- a/archival/uncompress.c +++ b/archival/uncompress.c @@ -61,11 +61,9 @@ int uncompress_main(int argc, char **argv) *extension = '\0'; /* Open output file */ - dst_fd = bb_xopen(uncompressed_file, O_WRONLY | O_CREAT); - - /* Set permissions on the file */ - stat(compressed_file, &stat_buf); - chmod(uncompressed_file, stat_buf.st_mode); + xstat(compressed_file, &stat_buf); + dst_fd = bb_xopen3(uncompressed_file, O_WRONLY | O_CREAT, + stat_buf.st_mode); /* If unzip succeeds remove the old file */ delete_path = compressed_file; diff --git a/archival/unlzma.c b/archival/unlzma.c index 404da0acd..b4881af75 100644 --- a/archival/unlzma.c +++ b/archival/unlzma.c @@ -47,10 +47,7 @@ int unlzma_main(int argc, char **argv) if (strcmp(extension, ".lzma") != 0) { bb_error_msg_and_die("Invalid extension"); } - /* TODO: xstat? */ - if (stat(filename, &stat_buf) < 0) { - bb_error_msg_and_die("Couldn't stat file %s", filename); - } + xstat(filename, &stat_buf); *extension = 0; dst_fd = bb_xopen3(filename, O_WRONLY | O_CREAT, stat_buf.st_mode); } else |