aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-27 04:44:51 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-27 04:44:51 +0000
commitd0119d15f97750c49f9955e6c6f952f03d72e795 (patch)
tree193a70e3d5ed19939c8460afb725c0fdf38d065d
parent8d42f86b146871ae4c4cafd3801a85f381249a14 (diff)
downloadbusybox-w32-d0119d15f97750c49f9955e6c6f952f03d72e795.tar.gz
busybox-w32-d0119d15f97750c49f9955e6c6f952f03d72e795.tar.bz2
busybox-w32-d0119d15f97750c49f9955e6c6f952f03d72e795.zip
Simple fixes accumulated after 1.3.0.
busybox-1.3.0.ash.patch busybox-1.3.0.bb_strtou.patch busybox-1.3.0.CONFIG_FEATURE_TAR_GNU_EXTENSIONS.patch busybox-1.3.0.dhcprelay.patch busybox-1.3.0.dpkg_ar.patch busybox-1.3.0.find.patch busybox-1.3.0.mount.patch busybox-1.3.0.perror.patch busybox-1.3.0.sed.patch busybox-1.3.0.shadow.patch busybox-1.3.0.xregcomp.patch
-rw-r--r--archival/libunarchive/get_header_ar.c23
-rw-r--r--archival/libunarchive/get_header_tar.c4
-rw-r--r--editors/sed.c3
-rw-r--r--findutils/find.c4
-rw-r--r--include/libbb.h2
-rw-r--r--include/xatonum.h14
-rw-r--r--libbb/Kbuild2
-rw-r--r--libbb/bb_strtonum.c1
-rw-r--r--libbb/perror_nomsg.c9
-rw-r--r--libbb/perror_nomsg_and_die.c10
-rw-r--r--networking/udhcp/dhcprelay.c3
-rw-r--r--shell/ash.c4
-rw-r--r--util-linux/mount.c3
13 files changed, 55 insertions, 27 deletions
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c
index 7f8c81ca0..897c89918 100644
--- a/archival/libunarchive/get_header_ar.c
+++ b/archival/libunarchive/get_header_ar.c
@@ -9,6 +9,7 @@
9 9
10char get_header_ar(archive_handle_t *archive_handle) 10char get_header_ar(archive_handle_t *archive_handle)
11{ 11{
12 int err;
12 file_header_t *typed = archive_handle->file_header; 13 file_header_t *typed = archive_handle->file_header;
13 union { 14 union {
14 char raw[60]; 15 char raw[60];
@@ -45,15 +46,23 @@ char get_header_ar(archive_handle_t *archive_handle)
45 archive_handle->offset += 60; 46 archive_handle->offset += 60;
46 47
47 /* align the headers based on the header magic */ 48 /* align the headers based on the header magic */
48 if ((ar.formatted.magic[0] != '`') || (ar.formatted.magic[1] != '\n')) { 49 if (ar.formatted.magic[0] != '`' || ar.formatted.magic[1] != '\n')
49 bb_error_msg_and_die("invalid ar header"); 50 bb_error_msg_and_die("invalid ar header");
50 }
51 51
52 typed->mode = xstrtoul(ar.formatted.mode, 8); 52 /* FIXME: more thorough routine would be in order here */
53 typed->mtime = xatou(ar.formatted.date); 53 /* (we have something like that in tar) */
54 typed->uid = xatou(ar.formatted.uid); 54 /* but for now we are lax. This code works because */
55 typed->gid = xatou(ar.formatted.gid); 55 /* on misformatted numbers bb_strtou returns all-ones */
56 typed->size = xatoul(ar.formatted.size); 56 typed->mode = err = bb_strtou(ar.formatted.mode, NULL, 8);
57 if (err == -1) bb_error_msg_and_die("invalid ar header");
58 typed->mtime = err = bb_strtou(ar.formatted.date, NULL, 10);
59 if (err == -1) bb_error_msg_and_die("invalid ar header");
60 typed->uid = err = bb_strtou(ar.formatted.uid, NULL, 10);
61 if (err == -1) bb_error_msg_and_die("invalid ar header");
62 typed->gid = err = bb_strtou(ar.formatted.gid, NULL, 10);
63 if (err == -1) bb_error_msg_and_die("invalid ar header");
64 typed->size = err = bb_strtou(ar.formatted.size, NULL, 10);
65 if (err == -1) bb_error_msg_and_die("invalid ar header");
57 66
58 /* long filenames have '/' as the first character */ 67 /* long filenames have '/' as the first character */
59 if (ar.formatted.name[0] == '/') { 68 if (ar.formatted.name[0] == '/') {
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 66c3314a1..88f72bd15 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)
74 74
75 if (sizeof(tar) != 512) 75 if (sizeof(tar) != 512)
76 BUG_tar_header_size(); 76 BUG_tar_header_size();
77 again:
78 77
78#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
79 again:
80#endif
79 /* Align header */ 81 /* Align header */
80 data_align(archive_handle, 512); 82 data_align(archive_handle, 512);
81 83
diff --git a/editors/sed.c b/editors/sed.c
index ac3d8d463..a6544fd0d 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -120,7 +120,6 @@ struct sed_globals {
120} bbg; 120} bbg;
121 121
122 122
123void sed_free_and_close_stuff(void);
124#if ENABLE_FEATURE_CLEAN_UP 123#if ENABLE_FEATURE_CLEAN_UP
125static void sed_free_and_close_stuff(void) 124static void sed_free_and_close_stuff(void)
126{ 125{
@@ -156,6 +155,8 @@ static void sed_free_and_close_stuff(void)
156 while (bbg.current_input_file < bbg.input_file_count) 155 while (bbg.current_input_file < bbg.input_file_count)
157 fclose(bbg.input_file_list[bbg.current_input_file++]); 156 fclose(bbg.input_file_list[bbg.current_input_file++]);
158} 157}
158#else
159void sed_free_and_close_stuff(void);
159#endif 160#endif
160 161
161/* If something bad happens during -i operation, delete temp file */ 162/* If something bad happens during -i operation, delete temp file */
diff --git a/findutils/find.c b/findutils/find.c
index bf6b71a83..c49a0010a 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -81,6 +81,7 @@ static inline int one_char(const char* str, char c)
81} 81}
82 82
83 83
84#if ENABLE_FEATURE_FIND_EXEC
84static int count_subst(const char *str) 85static int count_subst(const char *str)
85{ 86{
86 int count = 0; 87 int count = 0;
@@ -108,6 +109,7 @@ static char* subst(const char *src, int count, const char* filename)
108 strcpy(dst, src); 109 strcpy(dst, src);
109 return buf; 110 return buf;
110} 111}
112#endif
111 113
112 114
113static int exec_actions(action ***appp, const char *fileName, struct stat *statbuf) 115static int exec_actions(action ***appp, const char *fileName, struct stat *statbuf)
@@ -562,8 +564,8 @@ int find_main(int argc, char **argv)
562 argp[0] = "-a"; 564 argp[0] = "-a";
563 } 565 }
564 argp++; 566 argp++;
565 }
566#endif 567#endif
568 }
567 569
568 actions = parse_params(&argv[firstopt]); 570 actions = parse_params(&argv[firstopt]);
569 571
diff --git a/include/libbb.h b/include/libbb.h
index 1d91a0a72..65430d254 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -51,7 +51,9 @@
51 51
52#include "pwd_.h" 52#include "pwd_.h"
53#include "grp_.h" 53#include "grp_.h"
54#if ENABLE_FEATURE_SHADOWPASSWDS
54#include "shadow_.h" 55#include "shadow_.h"
56#endif
55 57
56/* Try to pull in PATH_MAX */ 58/* Try to pull in PATH_MAX */
57#include <limits.h> 59#include <limits.h>
diff --git a/include/xatonum.h b/include/xatonum.h
index 585d84623..8b1663789 100644
--- a/include/xatonum.h
+++ b/include/xatonum.h
@@ -115,7 +115,7 @@ extern inline
115unsigned long bb_strtoul(const char *arg, char **endp, int base) 115unsigned long bb_strtoul(const char *arg, char **endp, int base)
116{ return bb_strtoull(arg, endp, base); } 116{ return bb_strtoull(arg, endp, base); }
117extern inline 117extern inline
118unsigned long bb_strtol(const char *arg, char **endp, int base) 118long bb_strtol(const char *arg, char **endp, int base)
119{ return bb_strtoll(arg, endp, base); } 119{ return bb_strtoll(arg, endp, base); }
120#else 120#else
121unsigned long bb_strtoul(const char *arg, char **endp, int base); 121unsigned long bb_strtoul(const char *arg, char **endp, int base);
@@ -124,21 +124,21 @@ long bb_strtol(const char *arg, char **endp, int base);
124 124
125#if UINT_MAX == ULLONG_MAX 125#if UINT_MAX == ULLONG_MAX
126extern inline 126extern inline
127unsigned long bb_strtou(const char *arg, char **endp, int base) 127unsigned bb_strtou(const char *arg, char **endp, int base)
128{ return bb_strtoull(arg, endp, base); } 128{ return bb_strtoull(arg, endp, base); }
129extern inline 129extern inline
130unsigned long bb_strtoi(const char *arg, char **endp, int base) 130int bb_strtoi(const char *arg, char **endp, int base)
131{ return bb_strtoll(arg, endp, base); } 131{ return bb_strtoll(arg, endp, base); }
132#elif UINT_MAX == ULONG_MAX 132#elif UINT_MAX == ULONG_MAX
133extern inline 133extern inline
134unsigned long bb_strtou(const char *arg, char **endp, int base) 134unsigned bb_strtou(const char *arg, char **endp, int base)
135{ return bb_strtoul(arg, endp, base); } 135{ return bb_strtoul(arg, endp, base); }
136extern inline 136extern inline
137unsigned long bb_strtoi(const char *arg, char **endp, int base) 137int bb_strtoi(const char *arg, char **endp, int base)
138{ return bb_strtol(arg, endp, base); } 138{ return bb_strtol(arg, endp, base); }
139#else 139#else
140unsigned long bb_strtou(const char *arg, char **endp, int base); 140unsigned bb_strtou(const char *arg, char **endp, int base);
141long bb_strtoi(const char *arg, char **endp, int base); 141int bb_strtoi(const char *arg, char **endp, int base);
142#endif 142#endif
143 143
144int BUG_bb_strtou32_unimplemented(void); 144int BUG_bb_strtou32_unimplemented(void);
diff --git a/libbb/Kbuild b/libbb/Kbuild
index c15615302..827a5ce9f 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -113,5 +113,7 @@ lib-$(CONFIG_EJECT) += find_mount_point.o
113 113
114lib-$(CONFIG_AWK) += xregcomp.o 114lib-$(CONFIG_AWK) += xregcomp.o
115lib-$(CONFIG_SED) += xregcomp.o 115lib-$(CONFIG_SED) += xregcomp.o
116lib-$(CONFIG_GREP) += xregcomp.o
116lib-$(CONFIG_LESS) += xregcomp.o 117lib-$(CONFIG_LESS) += xregcomp.o
118lib-$(CONFIG_MDEV) += xregcomp.o
117lib-$(CONFIG_DEVFSD) += xregcomp.o 119lib-$(CONFIG_DEVFSD) += xregcomp.o
diff --git a/libbb/bb_strtonum.c b/libbb/bb_strtonum.c
index 6fbd1f87d..50ef0ba26 100644
--- a/libbb/bb_strtonum.c
+++ b/libbb/bb_strtonum.c
@@ -17,6 +17,7 @@
17 * errno = ERANGE if value had alphanumeric terminating char ("1234abcg"). 17 * errno = ERANGE if value had alphanumeric terminating char ("1234abcg").
18 * errno = ERANGE if value is out of range, missing, etc. 18 * errno = ERANGE if value is out of range, missing, etc.
19 * errno = ERANGE if value had minus sign for strtouXX (even "-0" is not ok ) 19 * errno = ERANGE if value had minus sign for strtouXX (even "-0" is not ok )
20 * return value is all-ones in this case.
20 */ 21 */
21 22
22static unsigned long long ret_ERANGE(void) 23static unsigned long long ret_ERANGE(void)
diff --git a/libbb/perror_nomsg.c b/libbb/perror_nomsg.c
index 3aefd5301..8059f9fd8 100644
--- a/libbb/perror_nomsg.c
+++ b/libbb/perror_nomsg.c
@@ -7,10 +7,13 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 8 */
9 9
10#include "libbb.h" 10/* gcc warns about a null format string, therefore we provide
11 * modified definition without "attribute (format)"
12 * instead of including libbb.h */
13//#include "libbb.h"
14extern void bb_perror_msg(const char *s, ...);
11 15
12void bb_perror_nomsg(void) 16void bb_perror_nomsg(void)
13{ 17{
14 /* Ignore the gcc warning about a null format string. */ 18 bb_perror_msg(0);
15 bb_perror_msg(NULL);
16} 19}
diff --git a/libbb/perror_nomsg_and_die.c b/libbb/perror_nomsg_and_die.c
index e5623c2a9..c416df67c 100644
--- a/libbb/perror_nomsg_and_die.c
+++ b/libbb/perror_nomsg_and_die.c
@@ -7,11 +7,13 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 8 */
9 9
10#include <stddef.h> 10/* gcc warns about a null format string, therefore we provide
11#include "libbb.h" 11 * modified definition without "attribute (format)"
12 * instead of including libbb.h */
13//#include "libbb.h"
14extern void bb_perror_msg_and_die(const char *s, ...);
12 15
13void bb_perror_nomsg_and_die(void) 16void bb_perror_nomsg_and_die(void)
14{ 17{
15 /* Ignore the gcc warning about a null format string. */ 18 bb_perror_msg_and_die(0);
16 bb_perror_msg_and_die(NULL);
17} 19}
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index e3a816886..4e84b8dd4 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -259,7 +259,8 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli
259{ 259{
260 struct dhcpMessage dhcp_msg; 260 struct dhcpMessage dhcp_msg;
261 fd_set rfds; 261 fd_set rfds;
262 size_t packlen, addr_size; 262 size_t packlen;
263 socklen_t addr_size;
263 struct sockaddr_in client_addr; 264 struct sockaddr_in client_addr;
264 struct timeval tv; 265 struct timeval tv;
265 int i; 266 int i;
diff --git a/shell/ash.c b/shell/ash.c
index 3a9998fc0..976c3f78a 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -85,7 +85,7 @@
85#ifdef CONFIG_ASH_JOB_CONTROL 85#ifdef CONFIG_ASH_JOB_CONTROL
86#define JOBS 1 86#define JOBS 1
87#else 87#else
88#undef JOBS 88#define JOBS 0
89#endif 89#endif
90 90
91#if JOBS || defined(CONFIG_ASH_READ_NCHARS) 91#if JOBS || defined(CONFIG_ASH_READ_NCHARS)
@@ -6647,7 +6647,7 @@ usage:
6647} 6647}
6648#endif /* JOBS */ 6648#endif /* JOBS */
6649 6649
6650#if defined(JOBS) || DEBUG 6650#if JOBS || DEBUG
6651static int 6651static int
6652jobno(const struct job *jp) 6652jobno(const struct job *jp)
6653{ 6653{
diff --git a/util-linux/mount.c b/util-linux/mount.c
index f8ae1df19..0fcd8e561 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1693,10 +1693,13 @@ int mount_main(int argc, char **argv)
1693 1693
1694 // Mount this thing. 1694 // Mount this thing.
1695 1695
1696 // NFS mounts want this to be xrealloc-able
1697 mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
1696 if (singlemount(mtcur, 1)) { 1698 if (singlemount(mtcur, 1)) {
1697 /* Count number of failed mounts */ 1699 /* Count number of failed mounts */
1698 rc++; 1700 rc++;
1699 } 1701 }
1702 free(mtcur->mnt_opts);
1700 } 1703 }
1701 } 1704 }
1702 if (ENABLE_FEATURE_CLEAN_UP) endmntent(fstab); 1705 if (ENABLE_FEATURE_CLEAN_UP) endmntent(fstab);