diff options
-rw-r--r-- | archival/libunarchive/get_header_ar.c | 23 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 4 | ||||
-rw-r--r-- | editors/sed.c | 3 | ||||
-rw-r--r-- | findutils/find.c | 4 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/Kbuild | 3 | ||||
-rw-r--r-- | libbb/bb_strtonum.c | 1 | ||||
-rw-r--r-- | libbb/perror_nomsg.c | 9 | ||||
-rw-r--r-- | libbb/perror_nomsg_and_die.c | 10 | ||||
-rw-r--r-- | networking/udhcp/dhcprelay.c | 3 | ||||
-rw-r--r-- | shell/ash.c | 4 | ||||
-rw-r--r-- | util-linux/mount.c | 3 |
12 files changed, 48 insertions, 21 deletions
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c index 6638c65..4e294b2 100644 --- a/archival/libunarchive/get_header_ar.c +++ b/archival/libunarchive/get_header_ar.c @@ -9,6 +9,7 @@ char get_header_ar(archive_handle_t *archive_handle) { + int err; file_header_t *typed = archive_handle->file_header; union { char raw[60]; @@ -45,15 +46,23 @@ char get_header_ar(archive_handle_t *archive_handle) archive_handle->offset += 60; /* align the headers based on the header magic */ - if ((ar.formatted.magic[0] != '`') || (ar.formatted.magic[1] != '\n')) { + if (ar.formatted.magic[0] != '`' || ar.formatted.magic[1] != '\n') bb_error_msg_and_die("invalid ar header"); - } - typed->mode = xstrtoul(ar.formatted.mode, 8); - typed->mtime = xatou(ar.formatted.date); - typed->uid = xatou(ar.formatted.uid); - typed->gid = xatou(ar.formatted.gid); - typed->size = xatoul(ar.formatted.size); + /* FIXME: more thorough routine would be in order here */ + /* (we have something like that in tar) */ + /* but for now we are lax. This code works because */ + /* on misformatted numbers bb_strtou returns all-ones */ + typed->mode = err = bb_strtou(ar.formatted.mode, NULL, 8); + if (err == -1) bb_error_msg_and_die("invalid ar header"); + typed->mtime = err = bb_strtou(ar.formatted.date, NULL, 10); + if (err == -1) bb_error_msg_and_die("invalid ar header"); + typed->uid = err = bb_strtou(ar.formatted.uid, NULL, 10); + if (err == -1) bb_error_msg_and_die("invalid ar header"); + typed->gid = err = bb_strtou(ar.formatted.gid, NULL, 10); + if (err == -1) bb_error_msg_and_die("invalid ar header"); + typed->size = err = bb_strtou(ar.formatted.size, NULL, 10); + if (err == -1) bb_error_msg_and_die("invalid ar header"); /* long filenames have '/' as the first character */ if (ar.formatted.name[0] == '/') { diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index beb8687..622f09f 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -74,8 +74,10 @@ char get_header_tar(archive_handle_t *archive_handle) if (sizeof(tar) != 512) BUG_tar_header_size(); - again: +#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS + again: +#endif /* Align header */ data_align(archive_handle, 512); diff --git a/editors/sed.c b/editors/sed.c index 95ced1c..23d73fa 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -120,7 +120,6 @@ struct sed_globals { } bbg; -void sed_free_and_close_stuff(void); #if ENABLE_FEATURE_CLEAN_UP static void sed_free_and_close_stuff(void) { @@ -156,6 +155,8 @@ static void sed_free_and_close_stuff(void) while (bbg.current_input_file < bbg.input_file_count) fclose(bbg.input_file_list[bbg.current_input_file++]); } +#else +void sed_free_and_close_stuff(void); #endif /* If something bad happens during -i operation, delete temp file */ diff --git a/findutils/find.c b/findutils/find.c index fffa3cd..2f94d13 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -76,6 +76,7 @@ static action ***actions; static int need_print = 1; +#if ENABLE_FEATURE_FIND_EXEC static int count_subst(const char *str) { int count = 0; @@ -103,6 +104,7 @@ static char* subst(const char *src, int count, const char* filename) strcpy(dst, src); return buf; } +#endif static int exec_actions(action ***appp, const char *fileName, struct stat *statbuf) @@ -556,8 +558,8 @@ int find_main(int argc, char **argv) argp[0] = "-a"; } argp++; - } #endif + } actions = parse_params(&argv[firstopt]); diff --git a/include/libbb.h b/include/libbb.h index 858adca..a2b9a82 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -51,7 +51,9 @@ #include "pwd_.h" #include "grp_.h" +#if ENABLE_FEATURE_SHADOWPASSWDS #include "shadow_.h" +#endif /* Try to pull in PATH_MAX */ #include <limits.h> diff --git a/libbb/Kbuild b/libbb/Kbuild index c156153..64e4531 100644 --- a/libbb/Kbuild +++ b/libbb/Kbuild @@ -113,5 +113,6 @@ lib-$(CONFIG_EJECT) += find_mount_point.o lib-$(CONFIG_AWK) += xregcomp.o lib-$(CONFIG_SED) += xregcomp.o -lib-$(CONFIG_LESS) += xregcomp.o +lib-$(CONFIG_GREP) += xregcomp.o +lib-$(CONFIG_MDEV) += xregcomp.o lib-$(CONFIG_DEVFSD) += xregcomp.o diff --git a/libbb/bb_strtonum.c b/libbb/bb_strtonum.c index 6fbd1f8..50ef0ba 100644 --- a/libbb/bb_strtonum.c +++ b/libbb/bb_strtonum.c @@ -17,6 +17,7 @@ * errno = ERANGE if value had alphanumeric terminating char ("1234abcg"). * errno = ERANGE if value is out of range, missing, etc. * errno = ERANGE if value had minus sign for strtouXX (even "-0" is not ok ) + * return value is all-ones in this case. */ static unsigned long long ret_ERANGE(void) diff --git a/libbb/perror_nomsg.c b/libbb/perror_nomsg.c index 3aefd53..8059f9f 100644 --- a/libbb/perror_nomsg.c +++ b/libbb/perror_nomsg.c @@ -7,10 +7,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include "libbb.h" +/* gcc warns about a null format string, therefore we provide + * modified definition without "attribute (format)" + * instead of including libbb.h */ +//#include "libbb.h" +extern void bb_perror_msg(const char *s, ...); void bb_perror_nomsg(void) { - /* Ignore the gcc warning about a null format string. */ - bb_perror_msg(NULL); + bb_perror_msg(0); } diff --git a/libbb/perror_nomsg_and_die.c b/libbb/perror_nomsg_and_die.c index e5623c2..c416df6 100644 --- a/libbb/perror_nomsg_and_die.c +++ b/libbb/perror_nomsg_and_die.c @@ -7,11 +7,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <stddef.h> -#include "libbb.h" +/* gcc warns about a null format string, therefore we provide + * modified definition without "attribute (format)" + * instead of including libbb.h */ +//#include "libbb.h" +extern void bb_perror_msg_and_die(const char *s, ...); void bb_perror_nomsg_and_die(void) { - /* Ignore the gcc warning about a null format string. */ - bb_perror_msg_and_die(NULL); + bb_perror_msg_and_die(0); } diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c index a3ea327..78a1b5e 100644 --- a/networking/udhcp/dhcprelay.c +++ b/networking/udhcp/dhcprelay.c @@ -257,7 +257,8 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli { struct dhcpMessage dhcp_msg; fd_set rfds; - size_t packlen, addr_size; + size_t packlen; + socklen_t addr_size; struct sockaddr_in client_addr; struct timeval tv; int i; diff --git a/shell/ash.c b/shell/ash.c index afb9b6a..dcf7705 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -85,7 +85,7 @@ #ifdef CONFIG_ASH_JOB_CONTROL #define JOBS 1 #else -#undef JOBS +#define JOBS 0 #endif #if JOBS || defined(CONFIG_ASH_READ_NCHARS) @@ -6647,7 +6647,7 @@ usage: } #endif /* JOBS */ -#if defined(JOBS) || DEBUG +#if JOBS || DEBUG static int jobno(const struct job *jp) { diff --git a/util-linux/mount.c b/util-linux/mount.c index 661e26f..b3e8c47 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -1708,10 +1708,13 @@ int mount_main(int argc, char **argv) // Mount this thing. + // NFS mounts want this to be xrealloc-able + mtcur->mnt_opts = xstrdup(mtcur->mnt_opts); if (singlemount(mtcur, 1)) { /* Count number of failed mounts */ rc++; } + free(mtcur->mnt_opts); } } if (ENABLE_FEATURE_CLEAN_UP) endmntent(fstab); |