X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=archival%2Fgunzip.c;h=ebbce411240ef415136688816e659830e26f4a37;hb=5d8843e451c01d8abfe6b5be772637310e9e581e;hp=4fb77044a2bbace45815125e305a6cf79b8f69b4;hpb=dfba741457cc81eb2ed3a9d4c074fbad74aa3249;p=oweals%2Fbusybox.git diff --git a/archival/gunzip.c b/archival/gunzip.c index 4fb77044a..ebbce4112 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c @@ -40,26 +40,6 @@ * See the file algorithm.doc for the compression algorithms and file formats. */ -#if 0 -static char *license_msg[] = { - " Copyright (C) 1992-1993 Jean-loup Gailly", - " This program is free software; you can redistribute it and/or modify", - " it under the terms of the GNU General Public License as published by", - " the Free Software Foundation; either version 2, or (at your option)", - " any later version.", - "", - " This program is distributed in the hope that it will be useful,", - " but WITHOUT ANY WARRANTY; without even the implied warranty of", - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", - " GNU General Public License for more details.", - "", - " You should have received a copy of the GNU General Public License", - " along with this program; if not, write to the Free Software", - " Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.", - 0 -}; -#endif - #include #include #include @@ -103,9 +83,7 @@ int gunzip_main(int argc, char **argv) src_fd = bb_xopen(old_path, O_RDONLY); /* Get the time stamp on the input file. */ - if (stat(old_path, &stat_buf) < 0) { - bb_error_msg_and_die("Couldn't stat file %s", old_path); - } + xstat(old_path, &stat_buf); } /* Check that the input is sane. */ @@ -139,11 +117,8 @@ int gunzip_main(int argc, char **argv) bb_error_msg_and_die("Invalid extension"); } - /* Open output file */ - dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT); - - /* Set permissions on the file */ - chmod(new_path, stat_buf.st_mode); + /* Open output file (with correct permissions) */ + dst_fd = bb_xopen3(new_path, O_WRONLY | O_CREAT, stat_buf.st_mode); /* If unzip succeeds remove the old file */ delete_path = old_path;