aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/bunzip2.c4
-rw-r--r--archival/cpio.c2
-rw-r--r--archival/gunzip.c8
-rw-r--r--archival/libunarchive/data_extract_to_stdout.c2
-rw-r--r--archival/rpm2cpio.c4
-rw-r--r--archival/tar.c4
-rw-r--r--archival/uncompress.c8
-rw-r--r--archival/unzip.c2
8 files changed, 17 insertions, 17 deletions
diff --git a/archival/bunzip2.c b/archival/bunzip2.c
index e2c3ca91d..ba422723c 100644
--- a/archival/bunzip2.c
+++ b/archival/bunzip2.c
@@ -52,7 +52,7 @@ int bunzip2_main(int argc, char **argv)
52 /* Open input file */ 52 /* Open input file */
53 src_fd = bb_xopen(compressed_name, O_RDONLY); 53 src_fd = bb_xopen(compressed_name, O_RDONLY);
54 } else { 54 } else {
55 src_fd = fileno(stdin); 55 src_fd = STDIN_FILENO;
56 opt |= BUNZIP2_OPT_STDOUT; 56 opt |= BUNZIP2_OPT_STDOUT;
57 } 57 }
58 58
@@ -62,7 +62,7 @@ int bunzip2_main(int argc, char **argv)
62 } 62 }
63 63
64 if (opt & BUNZIP2_OPT_STDOUT) { 64 if (opt & BUNZIP2_OPT_STDOUT) {
65 dst_fd = fileno(stdout); 65 dst_fd = STDOUT_FILENO;
66 } else { 66 } else {
67 int len = strlen(compressed_name) - 4; 67 int len = strlen(compressed_name) - 4;
68 if (strcmp(compressed_name + len, ".bz2") != 0) { 68 if (strcmp(compressed_name + len, ".bz2") != 0) {
diff --git a/archival/cpio.c b/archival/cpio.c
index aff6a55f9..0fbe7b8e5 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -47,7 +47,7 @@ extern int cpio_main(int argc, char **argv)
47 47
48 /* Initialise */ 48 /* Initialise */
49 archive_handle = init_handle(); 49 archive_handle = init_handle();
50 archive_handle->src_fd = fileno(stdin); 50 archive_handle->src_fd = STDIN_FILENO;
51 archive_handle->seek = seek_by_char; 51 archive_handle->seek = seek_by_char;
52 archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE; 52 archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE;
53 53
diff --git a/archival/gunzip.c b/archival/gunzip.c
index dec53f660..2c4dc49a4 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -98,7 +98,7 @@ extern int gunzip_main(int argc, char **argv)
98 optind++; 98 optind++;
99 99
100 if (old_path == NULL || strcmp(old_path, "-") == 0) { 100 if (old_path == NULL || strcmp(old_path, "-") == 0) {
101 src_fd = fileno(stdin); 101 src_fd = STDIN_FILENO;
102 opt |= GUNZIP_OPT_STDOUT; 102 opt |= GUNZIP_OPT_STDOUT;
103 } else { 103 } else {
104 src_fd = bb_xopen(old_path, O_RDONLY); 104 src_fd = bb_xopen(old_path, O_RDONLY);
@@ -119,7 +119,7 @@ extern int gunzip_main(int argc, char **argv)
119 if (opt & GUNZIP_OPT_TEST) { 119 if (opt & GUNZIP_OPT_TEST) {
120 dst_fd = bb_xopen("/dev/null", O_WRONLY); /* why does test use filenum 2 ? */ 120 dst_fd = bb_xopen("/dev/null", O_WRONLY); /* why does test use filenum 2 ? */
121 } else if (opt & GUNZIP_OPT_STDOUT) { 121 } else if (opt & GUNZIP_OPT_STDOUT) {
122 dst_fd = fileno(stdout); 122 dst_fd = STDOUT_FILENO;
123 } else { 123 } else {
124 char *extension; 124 char *extension;
125 125
@@ -178,10 +178,10 @@ extern int gunzip_main(int argc, char **argv)
178 delete_path = new_path; 178 delete_path = new_path;
179 } 179 }
180 180
181 if (dst_fd != fileno(stdout)) { 181 if (dst_fd != STDOUT_FILENO) {
182 close(dst_fd); 182 close(dst_fd);
183 } 183 }
184 if (src_fd != fileno(stdin)) { 184 if (src_fd != STDIN_FILENO) {
185 close(src_fd); 185 close(src_fd);
186 } 186 }
187 187
diff --git a/archival/libunarchive/data_extract_to_stdout.c b/archival/libunarchive/data_extract_to_stdout.c
index 7c4e7c78b..d4137a1a8 100644
--- a/archival/libunarchive/data_extract_to_stdout.c
+++ b/archival/libunarchive/data_extract_to_stdout.c
@@ -18,5 +18,5 @@
18 18
19extern void data_extract_to_stdout(archive_handle_t *archive_handle) 19extern void data_extract_to_stdout(archive_handle_t *archive_handle)
20{ 20{
21 bb_copyfd_size(archive_handle->src_fd, fileno(stdout), archive_handle->file_header->size); 21 bb_copyfd_size(archive_handle->src_fd, STDOUT_FILENO, archive_handle->file_header->size);
22} 22}
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index 7b5059518..5314e5300 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -73,7 +73,7 @@ extern int rpm2cpio_main(int argc, char **argv)
73 unsigned char magic[2]; 73 unsigned char magic[2];
74 74
75 if (argc == 1) { 75 if (argc == 1) {
76 rpm_fd = fileno(stdin); 76 rpm_fd = STDIN_FILENO;
77 } else { 77 } else {
78 rpm_fd = bb_xopen(argv[1], O_RDONLY); 78 rpm_fd = bb_xopen(argv[1], O_RDONLY);
79 } 79 }
@@ -96,7 +96,7 @@ extern int rpm2cpio_main(int argc, char **argv)
96 } 96 }
97 97
98 check_header_gzip(rpm_fd); 98 check_header_gzip(rpm_fd);
99 if (inflate_gunzip(rpm_fd, fileno(stdout)) != 0) { 99 if (inflate_gunzip(rpm_fd, STDOUT_FILENO) != 0) {
100 bb_error_msg("Error inflating"); 100 bb_error_msg("Error inflating");
101 } 101 }
102 102
diff --git a/archival/tar.c b/archival/tar.c
index 2310e80cb..279cbfd46 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -308,7 +308,7 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo,
308 if (tbInfo->verboseFlag) { 308 if (tbInfo->verboseFlag) {
309 FILE *vbFd = stdout; 309 FILE *vbFd = stdout;
310 310
311 if (tbInfo->tarFd == fileno(stdout)) /* If the archive goes to stdout, verbose to stderr */ 311 if (tbInfo->tarFd == STDOUT_FILENO) /* If the archive goes to stdout, verbose to stderr */
312 vbFd = stderr; 312 vbFd = stderr;
313 313
314 fprintf(vbFd, "%s\n", header.name); 314 fprintf(vbFd, "%s\n", header.name);
@@ -883,7 +883,7 @@ int tar_main(int argc, char **argv)
883 } 883 }
884 884
885#ifdef CONFIG_FEATURE_CLEAN_UP 885#ifdef CONFIG_FEATURE_CLEAN_UP
886 if (tar_handle->src_fd != fileno(stdin)) { 886 if (tar_handle->src_fd != STDIN_FILENO) {
887 close(tar_handle->src_fd); 887 close(tar_handle->src_fd);
888 } 888 }
889#endif /* CONFIG_FEATURE_CLEAN_UP */ 889#endif /* CONFIG_FEATURE_CLEAN_UP */
diff --git a/archival/uncompress.c b/archival/uncompress.c
index 2de37d273..48b4e2cad 100644
--- a/archival/uncompress.c
+++ b/archival/uncompress.c
@@ -46,7 +46,7 @@ extern int uncompress_main(int argc, char **argv)
46 int dst_fd; 46 int dst_fd;
47 47
48 if (strcmp(compressed_file, "-") == 0) { 48 if (strcmp(compressed_file, "-") == 0) {
49 src_fd = fileno(stdin); 49 src_fd = STDIN_FILENO;
50 flags |= GUNZIP_TO_STDOUT; 50 flags |= GUNZIP_TO_STDOUT;
51 } else { 51 } else {
52 src_fd = bb_xopen(compressed_file, O_RDONLY); 52 src_fd = bb_xopen(compressed_file, O_RDONLY);
@@ -60,7 +60,7 @@ extern int uncompress_main(int argc, char **argv)
60 60
61 /* Set output filename and number */ 61 /* Set output filename and number */
62 if (flags & GUNZIP_TO_STDOUT) { 62 if (flags & GUNZIP_TO_STDOUT) {
63 dst_fd = fileno(stdout); 63 dst_fd = STDOUT_FILENO;
64 } else { 64 } else {
65 struct stat stat_buf; 65 struct stat stat_buf;
66 char *extension; 66 char *extension;
@@ -96,10 +96,10 @@ extern int uncompress_main(int argc, char **argv)
96 delete_path = uncompressed_file; 96 delete_path = uncompressed_file;
97 } 97 }
98 98
99 if (dst_fd != fileno(stdout)) { 99 if (dst_fd != STDOUT_FILENO) {
100 close(dst_fd); 100 close(dst_fd);
101 } 101 }
102 if (src_fd != fileno(stdin)) { 102 if (src_fd != STDIN_FILENO) {
103 close(src_fd); 103 close(src_fd);
104 } 104 }
105 105
diff --git a/archival/unzip.c b/archival/unzip.c
index c670073f4..4e357d656 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -135,7 +135,7 @@ extern int unzip_main(int argc, char **argv)
135 } 135 }
136 136
137 if (*argv[optind] == '-') { 137 if (*argv[optind] == '-') {
138 archive_handle->src_fd = fileno(stdin); 138 archive_handle->src_fd = STDIN_FILENO;
139 archive_handle->seek = seek_by_char; 139 archive_handle->seek = seek_by_char;
140 } else { 140 } else {
141 archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY); 141 archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);