Replace current verbose GPL stuff in libbb/*.c with one-line GPL boilerplate.
[oweals/busybox.git] / archival / gunzip.c
index 4fb77044a2bbace45815125e305a6cf79b8f69b4..ebbce411240ef415136688816e659830e26f4a37 100644 (file)
  * 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 <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -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;