aboutsummaryrefslogtreecommitdiff
path: root/gzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'gzip.c')
-rw-r--r--gzip.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/gzip.c b/gzip.c
index ca0c177d4..09260929e 100644
--- a/gzip.c
+++ b/gzip.c
@@ -1867,18 +1867,13 @@ int gzip_main(int argc, char **argv)
1867 usage(gzip_usage); 1867 usage(gzip_usage);
1868 strncpy(ifname, *argv, MAX_PATH_LEN); 1868 strncpy(ifname, *argv, MAX_PATH_LEN);
1869 1869
1870 /* Open input fille */ 1870 /* Open input file */
1871 inFileNum = open(ifname, O_RDONLY); 1871 inFileNum = open(ifname, O_RDONLY);
1872 if (inFileNum < 0) { 1872 if (inFileNum < 0)
1873 perror(ifname); 1873 perror_msg_and_die("%s", ifname);
1874 exit(WARNING);
1875 }
1876 /* Get the time stamp on the input file. */ 1874 /* Get the time stamp on the input file. */
1877 result = stat(ifname, &statBuf); 1875 if (stat(ifname, &statBuf) < 0)
1878 if (result < 0) { 1876 perror_msg_and_die("%s", ifname);
1879 perror(ifname);
1880 exit(WARNING);
1881 }
1882 time_stamp = statBuf.st_ctime; 1877 time_stamp = statBuf.st_ctime;
1883 ifile_size = statBuf.st_size; 1878 ifile_size = statBuf.st_size;
1884 } 1879 }
@@ -1909,10 +1904,8 @@ int gzip_main(int argc, char **argv)
1909#else 1904#else
1910 outFileNum = open(ofname, O_RDWR | O_CREAT | O_EXCL); 1905 outFileNum = open(ofname, O_RDWR | O_CREAT | O_EXCL);
1911#endif 1906#endif
1912 if (outFileNum < 0) { 1907 if (outFileNum < 0)
1913 perror(ofname); 1908 perror_msg_and_die("%s", ofname);
1914 exit(WARNING);
1915 }
1916 SET_BINARY_MODE(outFileNum); 1909 SET_BINARY_MODE(outFileNum);
1917 /* Set permissions on the file */ 1910 /* Set permissions on the file */
1918 fchmod(outFileNum, statBuf.st_mode); 1911 fchmod(outFileNum, statBuf.st_mode);
@@ -1930,10 +1923,8 @@ int gzip_main(int argc, char **argv)
1930 else 1923 else
1931 delFileName = ofname; 1924 delFileName = ofname;
1932 1925
1933 if (unlink(delFileName) < 0) { 1926 if (unlink(delFileName) < 0)
1934 perror(delFileName); 1927 perror_msg_and_die("%s", delFileName);
1935 exit(EXIT_FAILURE);
1936 }
1937 } 1928 }
1938 1929
1939 return(exit_code); 1930 return(exit_code);