diff options
| author | Rob Landley <rob@landley.net> | 2006-08-03 17:58:17 +0000 |
|---|---|---|
| committer | Rob Landley <rob@landley.net> | 2006-08-03 17:58:17 +0000 |
| commit | 86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74 (patch) | |
| tree | b3002e01131f99581c1be3462b96b2f2c40408f4 | |
| parent | 7478804b783619762a52a740037126ef8711acc2 (diff) | |
| download | busybox-w32-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.tar.gz busybox-w32-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.tar.bz2 busybox-w32-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.zip | |
These should have been part of 15767 too.
| -rw-r--r-- | archival/cpio.c | 2 | ||||
| -rw-r--r-- | archival/gzip.c | 4 | ||||
| -rw-r--r-- | archival/tar.c | 6 | ||||
| -rw-r--r-- | coreutils/du.c | 2 | ||||
| -rw-r--r-- | include/xregex.h | 22 | ||||
| -rw-r--r-- | miscutils/eject.c | 5 | ||||
| -rw-r--r-- | modutils/lsmod.c | 36 | ||||
| -rw-r--r-- | networking/dnsd.c | 16 | ||||
| -rw-r--r-- | procps/fuser.c | 2 |
9 files changed, 34 insertions, 61 deletions
diff --git a/archival/cpio.c b/archival/cpio.c index 3576c8456..48b688e79 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
| @@ -67,7 +67,7 @@ int cpio_main(int argc, char **argv) | |||
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | if (cpio_filename) { /* CPIO_OPT_FILE */ | 69 | if (cpio_filename) { /* CPIO_OPT_FILE */ |
| 70 | archive_handle->src_fd = bb_xopen(cpio_filename, O_RDONLY); | 70 | archive_handle->src_fd = xopen(cpio_filename, O_RDONLY); |
| 71 | archive_handle->seek = seek_by_jump; | 71 | archive_handle->seek = seek_by_jump; |
| 72 | } | 72 | } |
| 73 | if (opt & CPIO_OPT_CREATE_LEADING_DIR) { | 73 | if (opt & CPIO_OPT_CREATE_LEADING_DIR) { |
diff --git a/archival/gzip.c b/archival/gzip.c index 486f78f88..0962a00a7 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
| @@ -1187,7 +1187,7 @@ int gzip_main(int argc, char **argv) | |||
| 1187 | ALLOC(ush, tab_prefix, 1L << BITS); | 1187 | ALLOC(ush, tab_prefix, 1L << BITS); |
| 1188 | 1188 | ||
| 1189 | /* Initialise the CRC32 table */ | 1189 | /* Initialise the CRC32 table */ |
| 1190 | crc_32_tab = bb_crc32_filltable(0); | 1190 | crc_32_tab = crc32_filltable(0); |
| 1191 | 1191 | ||
| 1192 | clear_bufs(); | 1192 | clear_bufs(); |
| 1193 | part_nb = 0; | 1193 | part_nb = 0; |
| @@ -1209,7 +1209,7 @@ int gzip_main(int argc, char **argv) | |||
| 1209 | inFileNum = STDIN_FILENO; | 1209 | inFileNum = STDIN_FILENO; |
| 1210 | outFileNum = STDOUT_FILENO; | 1210 | outFileNum = STDOUT_FILENO; |
| 1211 | } else { | 1211 | } else { |
| 1212 | inFileNum = bb_xopen3(argv[i], O_RDONLY, 0); | 1212 | inFileNum = xopen3(argv[i], O_RDONLY, 0); |
| 1213 | if (fstat(inFileNum, &statBuf) < 0) | 1213 | if (fstat(inFileNum, &statBuf) < 0) |
| 1214 | bb_perror_msg_and_die("%s", argv[i]); | 1214 | bb_perror_msg_and_die("%s", argv[i]); |
| 1215 | time_stamp = statBuf.st_ctime; | 1215 | time_stamp = statBuf.st_ctime; |
diff --git a/archival/tar.c b/archival/tar.c index 426176bd2..c49434713 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
| @@ -541,7 +541,7 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
| 541 | llist_t *newlist = NULL; | 541 | llist_t *newlist = NULL; |
| 542 | 542 | ||
| 543 | while (cur) { | 543 | while (cur) { |
| 544 | src_stream = bb_xfopen(cur->data, "r"); | 544 | src_stream = xfopen(cur->data, "r"); |
| 545 | tmp = cur; | 545 | tmp = cur; |
| 546 | cur = cur->link; | 546 | cur = cur->link; |
| 547 | free(tmp); | 547 | free(tmp); |
| @@ -824,12 +824,12 @@ int tar_main(int argc, char **argv) | |||
| 824 | tar_handle->src_fd = fileno(tar_stream); | 824 | tar_handle->src_fd = fileno(tar_stream); |
| 825 | tar_handle->seek = seek_by_char; | 825 | tar_handle->seek = seek_by_char; |
| 826 | } else { | 826 | } else { |
| 827 | tar_handle->src_fd = bb_xopen(tar_filename, flags); | 827 | tar_handle->src_fd = xopen(tar_filename, flags); |
| 828 | } | 828 | } |
| 829 | } | 829 | } |
| 830 | 830 | ||
| 831 | if (base_dir) | 831 | if (base_dir) |
| 832 | bb_xchdir(base_dir); | 832 | xchdir(base_dir); |
| 833 | 833 | ||
| 834 | /* create an archive */ | 834 | /* create an archive */ |
| 835 | if (ENABLE_FEATURE_TAR_CREATE && (opt & CTX_CREATE)) { | 835 | if (ENABLE_FEATURE_TAR_CREATE && (opt & CTX_CREATE)) { |
diff --git a/coreutils/du.c b/coreutils/du.c index b204a025a..29427c779 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
| @@ -121,7 +121,7 @@ static long du(char *filename) | |||
| 121 | struct dirent *entry; | 121 | struct dirent *entry; |
| 122 | char *newfile; | 122 | char *newfile; |
| 123 | 123 | ||
| 124 | dir = bb_opendir(filename); | 124 | dir = warn_opendir(filename); |
| 125 | if (!dir) { | 125 | if (!dir) { |
| 126 | status = EXIT_FAILURE; | 126 | status = EXIT_FAILURE; |
| 127 | return sum; | 127 | return sum; |
diff --git a/include/xregex.h b/include/xregex.h index 394ce3bae..188e90ff6 100644 --- a/include/xregex.h +++ b/include/xregex.h | |||
| @@ -1,30 +1,16 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* | 2 | /* |
| 3 | * Busybox xregcomp utility routine | 3 | * Busybox xregcomp utility routine. This isn't in libbb.h because the |
| 4 | * | 4 | * C library we're linking against may not support regex.h. |
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 19 | * | 5 | * |
| 20 | * Based in part on code from sash, Copyright (c) 1999 by David I. Bell | 6 | * Based in part on code from sash, Copyright (c) 1999 by David I. Bell |
| 21 | * Permission has been granted to redistribute this code under the GPL. | 7 | * Permission has been granted to redistribute this code under the GPL. |
| 22 | * | 8 | * |
| 9 | * Licensed under GPLv2 or later, see file License in this tarball for details. | ||
| 23 | */ | 10 | */ |
| 24 | #ifndef __BB_REGEX__ | 11 | #ifndef __BB_REGEX__ |
| 25 | #define __BB_REGEX__ | 12 | #define __BB_REGEX__ |
| 26 | 13 | ||
| 27 | #include <sys/types.h> | ||
| 28 | #include <regex.h> | 14 | #include <regex.h> |
| 29 | extern void xregcomp(regex_t *preg, const char *regex, int cflags); | 15 | extern void xregcomp(regex_t *preg, const char *regex, int cflags); |
| 30 | 16 | ||
diff --git a/miscutils/eject.c b/miscutils/eject.c index 8ac66779a..282090d38 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c | |||
| @@ -14,9 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include "busybox.h" | 16 | #include "busybox.h" |
| 17 | #include <fcntl.h> | ||
| 18 | #include <sys/ioctl.h> | ||
| 19 | #include <unistd.h> | ||
| 20 | #include <mntent.h> | 17 | #include <mntent.h> |
| 21 | 18 | ||
| 22 | /* various defines swiped from linux/cdrom.h */ | 19 | /* various defines swiped from linux/cdrom.h */ |
| @@ -40,7 +37,7 @@ int eject_main(int argc, char **argv) | |||
| 40 | erase_mtab(m->mnt_fsname); | 37 | erase_mtab(m->mnt_fsname); |
| 41 | } | 38 | } |
| 42 | } | 39 | } |
| 43 | if (ioctl(bb_xopen(device, (O_RDONLY | O_NONBLOCK)), | 40 | if (ioctl(xopen(device, (O_RDONLY | O_NONBLOCK)), |
| 44 | (flags ? CDROMCLOSETRAY : CDROMEJECT))) { | 41 | (flags ? CDROMCLOSETRAY : CDROMEJECT))) { |
| 45 | bb_perror_msg_and_die("%s", device); | 42 | bb_perror_msg_and_die("%s", device); |
| 46 | } | 43 | } |
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 1020158ed..18ee83929 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
| @@ -12,18 +12,18 @@ | |||
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include "busybox.h" | 14 | #include "busybox.h" |
| 15 | #include <stdlib.h> | 15 | //#include <stdlib.h> |
| 16 | #include <stdio.h> | 16 | //#include <stdio.h> |
| 17 | #include <string.h> | 17 | //#include <string.h> |
| 18 | #include <stddef.h> | 18 | //#include <stddef.h> |
| 19 | #include <errno.h> | 19 | //#include <errno.h> |
| 20 | #include <unistd.h> | 20 | //#include <unistd.h> |
| 21 | #include <dirent.h> | 21 | //#include <dirent.h> |
| 22 | #include <ctype.h> | 22 | //#include <ctype.h> |
| 23 | #include <assert.h> | 23 | //#include <assert.h> |
| 24 | #include <getopt.h> | 24 | //#include <getopt.h> |
| 25 | #include <sys/utsname.h> | 25 | //#include <sys/utsname.h> |
| 26 | #include <sys/file.h> | 26 | //#include <sys/file.h> |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | #ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE | 29 | #ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE |
| @@ -151,15 +151,14 @@ int lsmod_main(int argc, char **argv) | |||
| 151 | 151 | ||
| 152 | int lsmod_main(int argc, char **argv) | 152 | int lsmod_main(int argc, char **argv) |
| 153 | { | 153 | { |
| 154 | FILE *file = xfopen("/proc/modules", "r"); | ||
| 155 | |||
| 154 | printf("Module Size Used by"); | 156 | printf("Module Size Used by"); |
| 155 | check_tainted(); | 157 | check_tainted(); |
| 156 | #if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT) | 158 | #if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT) |
| 157 | { | 159 | { |
| 158 | FILE *file; | ||
| 159 | char line[4096]; | 160 | char line[4096]; |
| 160 | 161 | ||
| 161 | file = bb_xfopen("/proc/modules", "r"); | ||
| 162 | |||
| 163 | while (fgets(line, sizeof(line), file)) { | 162 | while (fgets(line, sizeof(line), file)) { |
| 164 | char *tok; | 163 | char *tok; |
| 165 | 164 | ||
| @@ -190,13 +189,10 @@ int lsmod_main(int argc, char **argv) | |||
| 190 | } | 189 | } |
| 191 | fclose(file); | 190 | fclose(file); |
| 192 | } | 191 | } |
| 193 | return EXIT_SUCCESS; | ||
| 194 | #else | 192 | #else |
| 195 | if (bb_xprint_file_by_name("/proc/modules") == 0) | 193 | xprint_and_close_file(file); |
| 196 | return EXIT_SUCCESS; | ||
| 197 | #endif /* CONFIG_FEATURE_2_6_MODULES */ | 194 | #endif /* CONFIG_FEATURE_2_6_MODULES */ |
| 198 | 195 | return EXIT_SUCCESS; | |
| 199 | return EXIT_FAILURE; | ||
| 200 | } | 196 | } |
| 201 | 197 | ||
| 202 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ | 198 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ |
diff --git a/networking/dnsd.c b/networking/dnsd.c index f8bd07e10..ec604e0e0 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c | |||
| @@ -17,12 +17,6 @@ | |||
| 17 | * the first porting of oao' scdns to busybox also. | 17 | * the first porting of oao' scdns to busybox also. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include <unistd.h> | ||
| 21 | #include <string.h> | ||
| 22 | #include <signal.h> | ||
| 23 | #include <arpa/inet.h> | ||
| 24 | #include <sys/socket.h> | ||
| 25 | #include <ctype.h> | ||
| 26 | #include "busybox.h" | 20 | #include "busybox.h" |
| 27 | 21 | ||
| 28 | static char *fileconf = "/etc/dnsd.conf"; | 22 | static char *fileconf = "/etc/dnsd.conf"; |
| @@ -170,7 +164,7 @@ static void dnsentryinit(int verb) | |||
| 170 | struct dns_entry *m, *prev; | 164 | struct dns_entry *m, *prev; |
| 171 | prev = dnsentry = NULL; | 165 | prev = dnsentry = NULL; |
| 172 | 166 | ||
| 173 | fp = bb_xfopen(fileconf, "r"); | 167 | fp = xfopen(fileconf, "r"); |
| 174 | 168 | ||
| 175 | while (1) { | 169 | while (1) { |
| 176 | m = xmalloc(sizeof(struct dns_entry)); | 170 | m = xmalloc(sizeof(struct dns_entry)); |
| @@ -198,7 +192,7 @@ static int listen_socket(char *iface_addr, int listen_port) | |||
| 198 | char msg[100]; | 192 | char msg[100]; |
| 199 | int s; | 193 | int s; |
| 200 | int yes = 1; | 194 | int yes = 1; |
| 201 | s = bb_xsocket(PF_INET, SOCK_DGRAM, 0); | 195 | s = xsocket(PF_INET, SOCK_DGRAM, 0); |
| 202 | #ifdef SO_REUSEADDR | 196 | #ifdef SO_REUSEADDR |
| 203 | if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0) | 197 | if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0) |
| 204 | bb_perror_msg_and_die("setsockopt() failed"); | 198 | bb_perror_msg_and_die("setsockopt() failed"); |
| @@ -208,8 +202,8 @@ static int listen_socket(char *iface_addr, int listen_port) | |||
| 208 | a.sin_family = AF_INET; | 202 | a.sin_family = AF_INET; |
| 209 | if (!inet_aton(iface_addr, &a.sin_addr)) | 203 | if (!inet_aton(iface_addr, &a.sin_addr)) |
| 210 | bb_perror_msg_and_die("bad iface address"); | 204 | bb_perror_msg_and_die("bad iface address"); |
| 211 | bb_xbind(s, (struct sockaddr *)&a, sizeof(a)); | 205 | xbind(s, (struct sockaddr *)&a, sizeof(a)); |
| 212 | listen(s, 50); /* bb_xlisten? */ | 206 | xlisten(s, 50); /* xlisten? */ |
| 213 | sprintf(msg, "accepting UDP packets on addr:port %s:%d\n", | 207 | sprintf(msg, "accepting UDP packets on addr:port %s:%d\n", |
| 214 | iface_addr, (int)listen_port); | 208 | iface_addr, (int)listen_port); |
| 215 | log_message(LOG_FILE, msg); | 209 | log_message(LOG_FILE, msg); |
| @@ -397,7 +391,7 @@ int dnsd_main(int argc, char **argv) | |||
| 397 | /* reexec for vfork() do continue parent */ | 391 | /* reexec for vfork() do continue parent */ |
| 398 | vfork_daemon_rexec(1, 0, argc, argv, "-d"); | 392 | vfork_daemon_rexec(1, 0, argc, argv, "-d"); |
| 399 | #else | 393 | #else |
| 400 | bb_xdaemon(1, 0); | 394 | xdaemon(1, 0); |
| 401 | #endif | 395 | #endif |
| 402 | 396 | ||
| 403 | dnsentryinit(is_verbose()); | 397 | dnsentryinit(is_verbose()); |
diff --git a/procps/fuser.c b/procps/fuser.c index 2965fc34b..aae24f50c 100644 --- a/procps/fuser.c +++ b/procps/fuser.c | |||
| @@ -83,7 +83,7 @@ static int fuser_parse_net_arg(const char *filename, | |||
| 83 | if((sscanf(filename, "%d/%4s", port, tproto)) != 2) return 0; | 83 | if((sscanf(filename, "%d/%4s", port, tproto)) != 2) return 0; |
| 84 | sprintf(path, "%s/net/%s", FUSER_PROC_DIR, tproto); | 84 | sprintf(path, "%s/net/%s", FUSER_PROC_DIR, tproto); |
| 85 | if((access(path, R_OK)) != 0) return 0; | 85 | if((access(path, R_OK)) != 0) return 0; |
| 86 | *proto = bb_xstrdup(tproto); | 86 | *proto = xstrdup(tproto); |
| 87 | return 1; | 87 | return 1; |
| 88 | } | 88 | } |
| 89 | 89 | ||
