aboutsummaryrefslogtreecommitdiff
path: root/gzip.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
committerMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
commita9819b290848e0a760f3805d5937fa050235d707 (patch)
treeb8cb8d939032c0806d62161b01e5836cb808dc3f /gzip.c
parente9f07fb6e83b75a50760599a5d31f494841eddf7 (diff)
downloadbusybox-a9819b290848e0a760f3805d5937fa050235d707.tar.gz
Use busybox error handling functions wherever possible.
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)
usage(gzip_usage);
strncpy(ifname, *argv, MAX_PATH_LEN);
- /* Open input fille */
+ /* Open input file */
inFileNum = open(ifname, O_RDONLY);
- if (inFileNum < 0) {
- perror(ifname);
- exit(WARNING);
- }
+ if (inFileNum < 0)
+ perror_msg_and_die("%s", ifname);
/* Get the time stamp on the input file. */
- result = stat(ifname, &statBuf);
- if (result < 0) {
- perror(ifname);
- exit(WARNING);
- }
+ if (stat(ifname, &statBuf) < 0)
+ perror_msg_and_die("%s", ifname);
time_stamp = statBuf.st_ctime;
ifile_size = statBuf.st_size;
}
@@ -1909,10 +1904,8 @@ int gzip_main(int argc, char **argv)
#else
outFileNum = open(ofname, O_RDWR | O_CREAT | O_EXCL);
#endif
- if (outFileNum < 0) {
- perror(ofname);
- exit(WARNING);
- }
+ if (outFileNum < 0)
+ perror_msg_and_die("%s", ofname);
SET_BINARY_MODE(outFileNum);
/* Set permissions on the file */
fchmod(outFileNum, statBuf.st_mode);
@@ -1930,10 +1923,8 @@ int gzip_main(int argc, char **argv)
else
delFileName = ofname;
- if (unlink(delFileName) < 0) {
- perror(delFileName);
- exit(EXIT_FAILURE);
- }
+ if (unlink(delFileName) < 0)
+ perror_msg_and_die("%s", delFileName);
}
return(exit_code);