aboutsummaryrefslogtreecommitdiff
path: root/archival/uncompress.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/uncompress.c')
-rw-r--r--archival/uncompress.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/archival/uncompress.c b/archival/uncompress.c
index 877bcc784..2d2145d18 100644
--- a/archival/uncompress.c
+++ b/archival/uncompress.c
@@ -45,7 +45,7 @@ int uncompress_main(int argc, char **argv)
45 flags |= gunzip_force; 45 flags |= gunzip_force;
46 break; 46 break;
47 default: 47 default:
48 show_usage(); /* exit's inside usage */ 48 bb_show_usage(); /* exit's inside usage */
49 } 49 }
50 } 50 }
51 51
@@ -63,17 +63,17 @@ int uncompress_main(int argc, char **argv)
63 src_fd = fileno(stdin); 63 src_fd = fileno(stdin);
64 flags |= gunzip_to_stdout; 64 flags |= gunzip_to_stdout;
65 } else { 65 } else {
66 src_fd = xopen(old_path, O_RDONLY); 66 src_fd = bb_xopen(old_path, O_RDONLY);
67 67
68 /* Get the time stamp on the input file. */ 68 /* Get the time stamp on the input file. */
69 if (stat(old_path, &stat_buf) < 0) { 69 if (stat(old_path, &stat_buf) < 0) {
70 error_msg_and_die("Couldn't stat file %s", old_path); 70 bb_error_msg_and_die("Couldn't stat file %s", old_path);
71 } 71 }
72 } 72 }
73 73
74 /* Check that the input is sane. */ 74 /* Check that the input is sane. */
75 if (isatty(src_fd) && ((flags & gunzip_force) == 0)) { 75 if (isatty(src_fd) && ((flags & gunzip_force) == 0)) {
76 error_msg_and_die 76 bb_error_msg_and_die
77 ("compressed data not read from terminal. Use -f to force it."); 77 ("compressed data not read from terminal. Use -f to force it.");
78 } 78 }
79 79
@@ -83,16 +83,16 @@ int uncompress_main(int argc, char **argv)
83 } else { 83 } else {
84 char *extension; 84 char *extension;
85 85
86 new_path = xstrdup(old_path); 86 new_path = bb_xstrdup(old_path);
87 87
88 extension = strrchr(new_path, '.'); 88 extension = strrchr(new_path, '.');
89 if (!extension || (strcmp(extension, ".Z") != 0)) { 89 if (!extension || (strcmp(extension, ".Z") != 0)) {
90 error_msg_and_die("Invalid extension"); 90 bb_error_msg_and_die("Invalid extension");
91 } 91 }
92 *extension = '\0'; 92 *extension = '\0';
93 93
94 /* Open output file */ 94 /* Open output file */
95 dst_fd = xopen(new_path, O_WRONLY | O_CREAT); 95 dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT);
96 96
97 /* Set permissions on the file */ 97 /* Set permissions on the file */
98 chmod(new_path, stat_buf.st_mode); 98 chmod(new_path, stat_buf.st_mode);
@@ -102,10 +102,10 @@ int uncompress_main(int argc, char **argv)
102 } 102 }
103 103
104 /* do the decompression, and cleanup */ 104 /* do the decompression, and cleanup */
105 if ((xread_char(src_fd) == 0x1f) && (xread_char(src_fd) == 0x9d)) { 105 if ((bb_xread_char(src_fd) == 0x1f) && (bb_xread_char(src_fd) == 0x9d)) {
106 status = uncompress(src_fd, dst_fd); 106 status = uncompress(src_fd, dst_fd);
107 } else { 107 } else {
108 error_msg_and_die("Invalid magic"); 108 bb_error_msg_and_die("Invalid magic");
109 } 109 }
110 110
111 if ((status != EXIT_SUCCESS) && (new_path)) { 111 if ((status != EXIT_SUCCESS) && (new_path)) {
@@ -122,7 +122,7 @@ int uncompress_main(int argc, char **argv)
122 122
123 /* delete_path will be NULL if in test mode or from stdin */ 123 /* delete_path will be NULL if in test mode or from stdin */
124 if (delete_path && (unlink(delete_path) == -1)) { 124 if (delete_path && (unlink(delete_path) == -1)) {
125 error_msg_and_die("Couldn't remove %s", delete_path); 125 bb_error_msg_and_die("Couldn't remove %s", delete_path);
126 } 126 }
127 127
128 free(new_path); 128 free(new_path);