1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-23 23:46:16 +02:00

package/busybox: update to busybox-1.7.1, include upstream patches

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22659 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
acoul 2010-08-15 09:53:21 +00:00
parent ef0f04cf25
commit 59736eb773
18 changed files with 325 additions and 229 deletions

View File

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=busybox
PKG_VERSION:=1.16.2
PKG_VERSION:=1.17.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.busybox.net/downloads \
http://distfiles.gentoo.org/distfiles/
PKG_MD5SUM:=2ba980f720a5bdce4ec05423519acc35
PKG_MD5SUM:=c7fe7533b7fc4018b0b49a05ee0ee601
include $(INCLUDE_DIR)/package.mk

View File

@ -1,18 +0,0 @@
--- a/applets/Kbuild
+++ b/applets/Kbuild
@@ -28,13 +28,13 @@ HOSTCFLAGS_usage_pod.o = -I$(srctree_sla
applets/applets.o: include/usage_compressed.h include/applet_tables.h
applets/applet_tables: .config $(srctree_slash)include/applets.h
-applets/usage: .config $(srctree_slash)include/applets.h
+applets/usage: .config $(srctree_slash)include/applets.h include/autoconf.h
applets/usage_pod: .config include/applet_tables.h $(srctree_slash)include/applets.h
quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
-include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
+include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed include/autoconf.h
$(call cmd,gen_usage_compressed)
quiet_cmd_gen_applet_tables = GEN include/applet_tables.h

View File

@ -18,20 +18,14 @@
};
int fd;
--- a/networking/Config.in
+++ b/networking/Config.in
@@ -77,12 +77,12 @@ config FEATURE_BRCTL_FANCY
--- a/networking/Config.src
+++ b/networking/Config.src
@@ -79,7 +79,7 @@ config FEATURE_BRCTL_FANCY
This adds about 600 bytes.
config FEATURE_BRCTL_SHOW
- bool "Support show, showmac and showstp"
+ bool "Support show"
default n
default y
depends on BRCTL && FEATURE_BRCTL_FANCY
help
Add support for option which prints the current config:
- showmacs, showstp, show
+ show
config DNSD
bool "dnsd"

View File

@ -1,52 +1,60 @@
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -164,6 +164,11 @@ uint16_t FAST_FUNC udhcp_checksum(void *
@@ -165,6 +165,11 @@ uint16_t FAST_FUNC udhcp_checksum(void *
return ~sum;
}
+int udhcp_get_payload_len(struct dhcp_packet *dhcp_pkt)
+{
+ return sizeof(struct dhcp_packet) - DHCP_OPTIONS_BUFSIZE + end_option(dhcp_pkt->options) + sizeof(dhcp_pkt->options[0]);
+ return sizeof(struct dhcp_packet) - DHCP_OPTIONS_BUFSIZE + udhcp_end_option(dhcp_pkt->options) + sizeof(dhcp_pkt->options[0]);
+}
+
/* Construct a ip/udp header for a packet, send packet */
int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
uint32_t source_ip, int source_port,
@@ -175,11 +180,7 @@ int FAST_FUNC udhcp_send_raw_packet(stru
uint32_t source_nip, int source_port,
@@ -173,11 +178,12 @@ int FAST_FUNC udhcp_send_raw_packet(stru
{
struct sockaddr_ll dest_sll;
struct ip_udp_dhcp_packet packet;
- unsigned padding;
int fd;
int result = -1;
const char *msg;
-
- enum {
- IP_UPD_DHCP_SIZE = sizeof(struct ip_udp_dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS,
- UPD_DHCP_SIZE = IP_UPD_DHCP_SIZE - offsetof(struct ip_udp_dhcp_packet, udp),
- };
+ int p_len = udhcp_get_payload_len(dhcp_pkt);
+ int p_len = udhcp_get_payload_len(dhcp_pkt);
+
fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP));
if (fd < 0) {
@@ -189,7 +190,7 @@ int FAST_FUNC udhcp_send_raw_packet(stru
msg = "socket(%s)";
@@ -186,7 +192,7 @@ int FAST_FUNC udhcp_send_raw_packet(stru
memset(&dest, 0, sizeof(dest));
memset(&packet, 0, sizeof(packet));
memset(&dest_sll, 0, sizeof(dest_sll));
memset(&packet, 0, offsetof(struct ip_udp_dhcp_packet, data));
- packet.data = *dhcp_pkt; /* struct copy */
+ memcpy(&(packet.data), dhcp_pkt, p_len);
dest.sll_family = AF_PACKET;
dest.sll_protocol = htons(ETH_P_IP);
@@ -206,24 +207,19 @@ int FAST_FUNC udhcp_send_raw_packet(stru
packet.ip.daddr = dest_ip;
dest_sll.sll_family = AF_PACKET;
dest_sll.sll_protocol = htons(ETH_P_IP);
@@ -208,27 +214,25 @@ int FAST_FUNC udhcp_send_raw_packet(stru
* In order to work with those buggy servers,
* we truncate packets after end option byte.
*/
- padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options);
packet.ip.protocol = IPPROTO_UDP;
packet.ip.saddr = source_nip;
packet.ip.daddr = dest_nip;
packet.udp.source = htons(source_port);
packet.udp.dest = htons(dest_port);
- /* size, excluding IP header: */
- packet.udp.len = htons(UPD_DHCP_SIZE);
- packet.udp.len = htons(UPD_DHCP_SIZE - padding);
- /* for UDP checksumming, ip.len is set to UDP packet len */
+ p_len += sizeof(packet.udp);
+ packet.udp.len = htons(p_len);
packet.ip.tot_len = packet.udp.len;
- packet.udp.check = udhcp_checksum(&packet, IP_UPD_DHCP_SIZE);
- packet.udp.check = udhcp_checksum(&packet, IP_UPD_DHCP_SIZE - padding);
- /* but for sending, it is set to IP packet len */
- packet.ip.tot_len = htons(IP_UPD_DHCP_SIZE);
- packet.ip.tot_len = htons(IP_UPD_DHCP_SIZE - padding);
+ p_len += sizeof(packet.ip);
+ packet.udp.check = udhcp_checksum(&packet, p_len);
+ packet.ip.tot_len = htons(p_len);
@ -55,34 +63,26 @@
packet.ip.ttl = IPDEFTTL;
packet.ip.check = udhcp_checksum(&packet.ip, sizeof(packet.ip));
- /* Currently we send full-sized DHCP packets (zero padded).
- * If you need to change this: last byte of the packet is
- * packet.data.options[end_option(packet.data.options)]
- */
udhcp_dump_packet(dhcp_pkt);
- result = sendto(fd, &packet, IP_UPD_DHCP_SIZE, 0,
- result = sendto(fd, &packet, IP_UPD_DHCP_SIZE - padding, /*flags:*/ 0,
+ result = sendto(fd, &packet, p_len, 0,
(struct sockaddr *) &dest, sizeof(dest));
(struct sockaddr *) &dest_sll, sizeof(dest_sll));
msg = "sendto";
ret_close:
@@ -245,10 +241,6 @@ int FAST_FUNC udhcp_send_kernel_packet(s
@@ -246,7 +250,6 @@ int FAST_FUNC udhcp_send_kernel_packet(s
uint32_t dest_nip, int dest_port)
{
struct sockaddr_in client;
- unsigned padding;
int fd;
int result = -1;
const char *msg;
@@ -278,8 +281,7 @@ int FAST_FUNC udhcp_send_kernel_packet(s
- enum {
- DHCP_SIZE = sizeof(struct dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS,
- };
-
fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {
msg = "socket(%s)";
@@ -274,9 +266,8 @@ int FAST_FUNC udhcp_send_kernel_packet(s
goto ret_close;
}
- /* Currently we send full-sized DHCP packets (see above) */
udhcp_dump_packet(dhcp_pkt);
- result = safe_write(fd, dhcp_pkt, DHCP_SIZE);
- padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options);
- result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding);
+ result = safe_write(fd, dhcp_pkt, udhcp_get_payload_len(dhcp_pkt));
msg = "write";
ret_close:

View File

@ -1,16 +1,16 @@
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -126,6 +126,7 @@ int FAST_FUNC send_decline(uint32_t xid,
int FAST_FUNC send_discover(uint32_t xid, uint32_t requested)
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -428,6 +428,7 @@ static int raw_bcast_from_client_config_
static int send_discover(uint32_t xid, uint32_t requested)
{
struct dhcp_packet packet;
+ static int msgs = 0;
init_packet(&packet, DHCPDISCOVER);
packet.xid = xid;
@@ -138,6 +139,7 @@ int FAST_FUNC send_discover(uint32_t xid
add_param_req_option(&packet);
@@ -438,6 +439,7 @@ static int send_discover(uint32_t xid, u
udhcp_add_simple_option(&packet, DHCP_MAX_SIZE, htons(576));
add_client_options(&packet);
+ if (msgs++ < 3)
bb_info_msg("Sending discover...");

View File

@ -1,5 +1,5 @@
--- a/include/applets.h
+++ b/include/applets.h
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -282,6 +282,7 @@ IF_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_D
IF_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_DROP))
IF_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_DROP))
@ -8,8 +8,8 @@
IF_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_DROP))
IF_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_DROP))
IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP))
--- a/include/usage.h
+++ b/include/usage.h
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -3166,6 +3166,9 @@
#endif
@ -20,23 +20,23 @@
#define netstat_trivial_usage \
"[-laentuwxr"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]"
#define netstat_full_usage "\n\n" \
--- a/networking/Config.in
+++ b/networking/Config.in
@@ -628,6 +628,12 @@ config NC
A simple Unix utility which reads and writes data across network
connections.
--- a/networking/Config.src
+++ b/networking/Config.src
@@ -623,6 +623,12 @@ config FEATURE_NAMEIF_EXTENDED
new_interface_name mac=00:80:C8:38:91:B5
new_interface_name 00:80:C8:38:91:B5
+config NETMSG
+ bool "netmsg"
+ default n
+ help
+ simple program for sending udp broadcast messages
+ simple program for sending udp broadcast messages
+
config NC_SERVER
bool "Netcat server options (-l)"
default n
--- a/networking/Kbuild
+++ b/networking/Kbuild
config NETSTAT
bool "netstat"
default y
--- a/networking/Kbuild.src
+++ b/networking/Kbuild.src
@@ -25,6 +25,7 @@ lib-$(CONFIG_IP) += ip.o
lib-$(CONFIG_IPCALC) += ipcalc.o
lib-$(CONFIG_NAMEIF) += nameif.o

View File

@ -1,5 +1,5 @@
--- a/include/applets.h
+++ b/include/applets.h
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -234,6 +234,7 @@ IF_LN(APPLET_NOEXEC(ln, ln, _BB_DIR_BIN,
IF_LOAD_POLICY(APPLET(load_policy, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
IF_LOADFONT(APPLET(loadfont, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
@ -8,8 +8,8 @@
IF_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_REQUIRE))
IF_LOGNAME(APPLET_NOFORK(logname, logname, _BB_DIR_USR_BIN, _BB_SUID_DROP, logname))
--- a/include/usage.h
+++ b/include/usage.h
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -2357,6 +2357,9 @@
#define loadkmap_example_usage \
"$ loadkmap < /etc/i18n/lang-keymap\n"
@ -20,8 +20,8 @@
#define logger_trivial_usage \
"[OPTIONS] [MESSAGE]"
#define logger_full_usage "\n\n" \
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
--- a/miscutils/Config.src
+++ b/miscutils/Config.src
@@ -463,6 +463,11 @@ config FEATURE_HDPARM_HDIO_GETSET_DMA
help
Enables the 'hdparm -d' option to get/set using_dma flag.
@ -34,8 +34,8 @@
config MAKEDEVS
bool "makedevs"
default n
--- a/miscutils/Kbuild
+++ b/miscutils/Kbuild
--- a/miscutils/Kbuild.src
+++ b/miscutils/Kbuild.src
@@ -27,6 +27,7 @@ lib-$(CONFIG_INOTIFYD) += inotifyd.o
lib-$(CONFIG_FEATURE_LAST_SMALL)+= last.o
lib-$(CONFIG_FEATURE_LAST_FANCY)+= last_fancy.o

View File

@ -1,22 +1,25 @@
--- a/include/usage.h
+++ b/include/usage.h
@@ -1727,6 +1727,7 @@
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -1718,7 +1718,8 @@ INSERT
IF_FEATURE_HTTPD_SETUID(" [-u USER[:GRP]]") \
IF_FEATURE_HTTPD_BASIC_AUTH(" [-r REALM]") \
" [-h HOME]\n" \
"or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING"
- "or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING"
+ "or httpd -d/-e" IF_FEATURE_HTTPD_AUTH_MD5("/-m") " STRING" \
+ " [-R <path> [-H <host>]]"
#define httpd_full_usage "\n\n" \
"Listen for incoming HTTP requests\n" \
"\nOptions:" \
@@ -1744,6 +1745,8 @@
"\n -m STRING MD5 crypt STRING") \
"\n -e STRING HTML encode STRING" \
"\n -d STRING URL decode STRING" \
+ "\n -R PATH Redirect target path" \
+ "\n -H HOST Redirect target host" \
@@ -2319,6 +2320,9 @@ INSERT
#define loadkmap_example_usage \
"$ loadkmap < /etc/i18n/lang-keymap\n"
#define hwclock_trivial_usage \
IF_FEATURE_HWCLOCK_LONG_OPTIONS( \
+#define lock_trivial_usage NOUSAGE_STR
+#define lock_full_usage ""
+
#define logger_trivial_usage \
"[OPTIONS] [MESSAGE]"
#define logger_full_usage "\n\n" \
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -250,6 +250,8 @@ struct globals {

View File

@ -1,46 +0,0 @@
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -79,6 +79,7 @@ static int in_cksum(unsigned short *buf,
/* simple version */
static char *hostname;
+static unsigned datalen = DEFDATALEN;
static void noresp(int ign UNUSED_PARAM)
{
@@ -91,7 +92,7 @@ static void ping4(len_and_sockaddr *lsa)
struct sockaddr_in pingaddr;
struct icmp *pkt;
int pingsock, c;
- char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
+ char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
pingsock = create_icmp_socket();
pingaddr = lsa->u.sin;
@@ -101,7 +102,7 @@ static void ping4(len_and_sockaddr *lsa)
pkt->icmp_type = ICMP_ECHO;
pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
- c = xsendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN,
+ c = xsendto(pingsock, packet, datalen + ICMP_MINLEN,
(struct sockaddr *) &pingaddr, sizeof(pingaddr));
/* listen for replies */
@@ -135,7 +136,7 @@ static void ping6(len_and_sockaddr *lsa)
struct icmp6_hdr *pkt;
int pingsock, c;
int sockopt;
- char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
+ char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
pingsock = create_icmp6_socket();
pingaddr = lsa->u.sin6;
@@ -147,7 +148,7 @@ static void ping6(len_and_sockaddr *lsa)
sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
- c = xsendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr),
+ c = xsendto(pingsock, packet, datalen + sizeof (struct icmp6_hdr),
(struct sockaddr *) &pingaddr, sizeof(pingaddr));
/* listen for replies */

View File

@ -117,14 +117,14 @@
+done:
return rc;
}
--- a/modutils/Config.in
+++ b/modutils/Config.in
@@ -226,7 +226,7 @@ config FEATURE_MODUTILS_SYMBOLS
--- a/modutils/Config.src
+++ b/modutils/Config.src
@@ -228,7 +228,7 @@ config FEATURE_MODUTILS_SYMBOLS
config DEFAULT_MODULES_DIR
string "Default directory containing modules"
default "/lib/modules"
- depends on DEPMOD || MODPROBE || MODPROBE_SMALL
+ depends on DEPMOD || INSMOD || MODPROBE || MODPROBE_SMALL
- depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO
+ depends on DEPMOD || MODPROBE || MODPROBE_SMALL || MODINFO || INSMOD
help
Directory that contains kernel modules.
Defaults to "/lib/modules"

View File

@ -1,6 +1,6 @@
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -53,9 +53,14 @@ typedef struct chain_s {
@@ -70,9 +70,14 @@ typedef struct chain_s {
} chain;
/* Function */
@ -15,7 +15,7 @@
} func;
/* I/O stream */
@@ -1424,7 +1429,8 @@ static void parse_program(char *p)
@@ -1453,7 +1458,8 @@ static void parse_program(char *p)
next_token(TC_FUNCTION);
g_pos++;
f = newfunc(t_string);
@ -25,38 +25,38 @@
f->nargs = 0;
while (next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) {
v = findvar(ahash, t_string);
@@ -1433,7 +1439,7 @@ static void parse_program(char *p)
@@ -1462,7 +1468,7 @@ static void parse_program(char *p)
if (next_token(TC_COMMA | TC_SEQTERM) & TC_SEQTERM)
break;
}
- seq = &(f->body);
+ seq = &(f->x.body);
- seq = &f->body;
+ seq = &f->x.body;
chain_group();
clear_array(ahash);
@@ -2446,7 +2452,8 @@ static var *evaluate(node *op, var *res)
break;
@@ -2547,7 +2553,8 @@ static var *evaluate(node *op, var *res)
var *vbeg, *v;
const char *sv_progname;
case XC( OC_FUNC ):
- if (!op->r.f->body.first)
+ if ((op->r.f->type == AWKFUNC) &&
+ !op->r.f->x.body.first)
syntax_error(EMSG_UNDEF_FUNC);
X.v = R.v = nvalloc(op->r.f->nargs + 1);
@@ -2463,7 +2470,10 @@ static var *evaluate(node *op, var *res)
fnargs = X.v;
vbeg = v = nvalloc(op->r.f->nargs + 1);
@@ -2564,7 +2571,10 @@ static var *evaluate(node *op, var *res)
fnargs = vbeg;
sv_progname = g_progname;
L.s = g_progname;
- res = evaluate(op->r.f->body.first, res);
+ if (op->r.f->type == AWKFUNC)
+ res = evaluate(op->r.f->x.body.first, res);
+ else if (op->r.f->type == CFUNC)
+ res = op->r.f->x.cfunc(res, fnargs, op->r.f->nargs);
g_progname = L.s;
g_progname = sv_progname;
nvfree(fnargs);
@@ -2829,6 +2839,143 @@ static rstream *next_input_file(void)
@@ -2942,6 +2952,143 @@ static rstream *next_input_file(void)
#undef files_happen
}
@ -200,7 +200,7 @@
int awk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int awk_main(int argc, char **argv)
{
@@ -2894,6 +3041,9 @@ int awk_main(int argc, char **argv)
@@ -3007,6 +3154,9 @@ int awk_main(int argc, char **argv)
*s1 = '=';
}
}

View File

@ -1,40 +1,47 @@
Index: busybox-1.16.1/sysklogd/syslogd.c
===================================================================
--- busybox-1.16.1.orig/sysklogd/syslogd.c 2010-03-28 13:44:04.000000000 -0400
+++ busybox-1.16.1/sysklogd/syslogd.c 2010-06-17 21:48:11.000000000 -0400
@@ -555,6 +555,7 @@
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -98,6 +98,8 @@ struct globals {
GLOBALS
#if ENABLE_FEATURE_REMOTE_LOG
+ len_and_sockaddr *remoteAddr;
+ int remoteFD;
llist_t *remoteHosts;
#endif
#if ENABLE_FEATURE_IPC_SYSLOG
@@ -554,6 +556,7 @@ static void do_syslogd(void) NORETURN;
static void do_syslogd(void)
{
int sock_fd;
+ int send_err = 0;
#if ENABLE_FEATURE_SYSLOGD_DUP
int last_sz = -1;
char *last_buf;
@@ -632,10 +633,23 @@
* over network, mimic that */
recvbuf[sz] = '\n';
/* send message to remote logger, ignore possible error */
#if ENABLE_FEATURE_REMOTE_LOG
llist_t *item;
#endif
@@ -637,10 +640,23 @@ static void do_syslogd(void)
continue;
}
/* Send message to remote logger, ignore possible error */
- /* TODO: on some errors, close and set G.remoteFD to -1
- * so that DNS resolution and connect is retried? */
- sendto(G.remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
- &G.remoteAddr->u.sa, G.remoteAddr->len);
+ if ( sendto(G.remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
+ &G.remoteAddr->u.sa, G.remoteAddr->len) == -1 ) {
- sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
- &(rh->remoteAddr->u.sa), rh->remoteAddr->len);
+ if (sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
+ &G.remoteAddr->u.sa, G.remoteAddr->len) == -1 ) {
+ send_err = errno;
+ }
+ }
+
+ /* On some errors, close and set G.remoteFD to -1
+ * so that DNS resolution and connect is retried */
+ switch (send_err) {
+ case ECONNRESET:
+ case EDESTADDRREQ:
+ case EISCONN:
+ case ENOTCONN:
+ case EPIPE:
+ switch (send_err) {
+ case ECONNRESET:
+ case EDESTADDRREQ:
+ case EISCONN:
+ case ENOTCONN:
+ case EPIPE:
+ close(G.remoteFD);
+ G.remoteFD = -1;
+ break;
+ }
no_luck: ;
+ }
}
#endif
if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {

View File

@ -1,13 +0,0 @@
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -48,8 +48,9 @@ static ALWAYS_INLINE void strtotimeval(s
{
double secs;
#if BRCTL_USE_INTERNAL
+ errno = 0;
secs = /*bb_*/strtod(time_str, NULL);
- if (!secs)
+ if (errno)
#else
if (sscanf(time_str, "%lf", &secs) != 1)
#endif

View File

@ -4,8 +4,8 @@
/* Maximum number of ports supported per bridge interface. */
#ifndef MAX_PORTS
-#define MAX_PORTS 32
+#define MAX_PORTS 1024
-# define MAX_PORTS 32
+# define MAX_PORTS 1024
#endif
/* Use internal number parsing and not the "exact" conversion. */

View File

@ -1,11 +0,0 @@
--- a/include/platform.h
+++ b/include/platform.h
@@ -253,7 +253,7 @@ typedef int socklen_t;
# define HAVE_FEATURES_H
# include <stdint.h>
# define HAVE_STDINT_H
-#elif !defined __APPLE__
+#elif !defined(__APPLE__) && !defined(__FreeBSD__)
/* Largest integral types. */
# if BB_BIG_ENDIAN
/* Looks BROKEN! */

View File

@ -0,0 +1,11 @@
--- a/debianutils/mktemp.ci
+++ b/debianutils/mktemp.c
@@ -50,7 +50,7 @@ int mktemp_main(int argc UNUSED_PARAM, c
opts = getopt32(argv, "dqtp:", &path);
chp = argv[optind] ? argv[optind] : xstrdup("tmp.XXXXXX");
- if (chp[0] != '/' || (opts & 8))
+ if (!strchr(chp, '/') || (opts & 8))
chp = concat_path_file(path, chp);
if (opts & 1) { /* -d */

View File

@ -0,0 +1,65 @@
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -61,6 +61,10 @@
#include "libbb.h"
#include "xregex.h"
+enum {
+ OPT_in_place = 1 << 0,
+};
+
/* Each sed command turns into one of these structures. */
typedef struct sed_cmd_s {
/* Ordered by alignment requirements: currently 36 bytes on x86 */
@@ -938,8 +942,11 @@ static void process_files(void)
if (matched) {
/* once matched, "n,xxx" range is dead, disabling it */
- if (sed_cmd->beg_line > 0)
+ if (sed_cmd->beg_line > 0
+ && !(option_mask32 & OPT_in_place) /* but not for -i */
+ ) {
sed_cmd->beg_line = -2;
+ }
sed_cmd->in_match = !(
/* has the ending line come, or is this a single address command? */
(sed_cmd->end_line ?
@@ -1270,9 +1277,6 @@ static void add_cmd_block(char *cmdstr)
int sed_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sed_main(int argc UNUSED_PARAM, char **argv)
{
- enum {
- OPT_in_place = 1 << 0,
- };
unsigned opt;
llist_t *opt_e, *opt_f;
int status = EXIT_SUCCESS;
@@ -1292,6 +1296,7 @@ int sed_main(int argc UNUSED_PARAM, char
opt_e = opt_f = NULL;
opt_complementary = "e::f::" /* can occur multiple times */
"nn"; /* count -n */
+ /* -i must be first, to match OPT_in_place definition */
opt = getopt32(argv, "irne:f:", &opt_e, &opt_f,
&G.be_quiet); /* counter for -n */
//argc -= optind;
diff -urpN busybox-1.17.1/testsuite/sed.tests busybox-1.17.1-sed/testsuite/sed.tests
--- busybox-1.17.1/testsuite/sed.tests 2010-07-06 04:25:54.000000000 +0200
+++ busybox-1.17.1-sed/testsuite/sed.tests 2010-08-01 04:19:26.000000000 +0200
@@ -270,11 +270,16 @@ testing "sed a cmd ended by double backs
| two \\
'
-# fisrt three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges
+# first three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges
testing "sed with N skipping lines past ranges on next cmds" \
"sed -n '1{N;N;d};1p;2,3p;3p;4p'" \
"4\n4\n" "" "1\n2\n3\n4\n"
+testing "sed -i with address modifies all files, not only first" \
+ "cp input input2; sed -i -e '1s/foo/bar/' input input2 && cat input input2; rm input2" \
+ "bar\nbar\n" "foo\n" ""
+
+
# testing "description" "arguments" "result" "infile" "stdin"
exit $FAILCOUNT

View File

@ -0,0 +1,104 @@
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4515,6 +4515,7 @@ clear_traps(void)
INT_ON;
}
}
+ may_have_traps = 0;
}
/* Lives far away from here, needed for forkchild */
diff -urpN busybox-1.17.1/shell/ash_test/ash-signals/signal7.right busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.right
--- busybox-1.17.1/shell/ash_test/ash-signals/signal7.right 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.right 2010-07-25 13:09:32.000000000 +0200
@@ -0,0 +1 @@
+Bug detected: 0
diff -urpN busybox-1.17.1/shell/ash_test/ash-signals/signal7.tests busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.tests
--- busybox-1.17.1/shell/ash_test/ash-signals/signal7.tests 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.17.1-shell/shell/ash_test/ash-signals/signal7.tests 2010-07-25 13:09:32.000000000 +0200
@@ -0,0 +1,18 @@
+bug() {
+ trap : exit
+ # Bug was causing sh to be run in subshell,
+ # as if this line is replaced with (sh -c ...; exit $?) &
+ # here:
+ sh -c 'echo REAL_CHILD=$$' &
+ echo PARENTS_IDEA_OF_CHILD=$!
+ wait # make sure bkgd shell completes
+}
+
+bug | {
+while read varval; do
+ eval $varval
+done
+test x"$REAL_CHILD" != x"" \
+&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD"
+echo "Bug detected: $?"
+}
diff -urpN busybox-1.17.1/shell/hush.c busybox-1.17.1-shell/shell/hush.c
--- busybox-1.17.1/shell/hush.c 2010-07-25 00:12:43.000000000 +0200
+++ busybox-1.17.1-shell/shell/hush.c 2010-07-25 13:09:32.000000000 +0200
@@ -3901,8 +3901,6 @@ static void insert_bg_job(struct pipe *p
if (G_interactive_fd)
printf("[%d] %d %s\n", job->jobid, job->cmds[0].pid, job->cmdtext);
- /* Last command's pid goes to $! */
- G.last_bg_pid = job->cmds[job->num_cmds - 1].pid;
G.last_jobid = job->jobid;
}
@@ -4825,6 +4823,8 @@ static int run_list(struct pipe *pi)
if (G.run_list_level == 1)
insert_bg_job(pi);
#endif
+ /* Last command's pid goes to $! */
+ G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid;
G.last_exitcode = rcode = EXIT_SUCCESS;
debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n");
} else {
diff -urpN busybox-1.17.1/shell/hush_test/hush-trap/signal7.right busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.right
--- busybox-1.17.1/shell/hush_test/hush-trap/signal7.right 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.right 2010-07-25 13:09:32.000000000 +0200
@@ -0,0 +1 @@
+Bug detected: 0
diff -urpN busybox-1.17.1/shell/hush_test/hush-trap/signal7.tests busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.tests
--- busybox-1.17.1/shell/hush_test/hush-trap/signal7.tests 1970-01-01 01:00:00.000000000 +0100
+++ busybox-1.17.1-shell/shell/hush_test/hush-trap/signal7.tests 2010-07-25 13:09:32.000000000 +0200
@@ -0,0 +1,18 @@
+bug() {
+ trap : exit
+ # Bug was causing sh to be run in subshell,
+ # as if this line is replaced with (sh -c ...; exit $?) &
+ # here:
+ sh -c 'echo REAL_CHILD=$$' &
+ echo PARENTS_IDEA_OF_CHILD=$!
+ wait # make sure bkgd shell completes
+}
+
+bug | {
+while read varval; do
+ eval $varval
+done
+test x"$REAL_CHILD" != x"" \
+&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD"
+echo "Bug detected: $?"
+}
diff -urpN busybox-1.17.1/shell/shell_common.c busybox-1.17.1-shell/shell/shell_common.c
--- busybox-1.17.1/shell/shell_common.c 2010-07-06 04:25:54.000000000 +0200
+++ busybox-1.17.1-shell/shell/shell_common.c 2010-07-27 08:41:43.000000000 +0200
@@ -428,9 +428,14 @@ shell_builtin_ulimit(char **argv)
val <<= l->factor_shift;
}
//bb_error_msg("opt %c val_str:'%s' val:%lld", opt_char, val_str, (long long)val);
+ /* from man bash: "If neither -H nor -S
+ * is specified, both the soft and hard
+ * limits are set. */
+ if (!opts)
+ opts = OPT_hard + OPT_soft;
if (opts & OPT_hard)
limit.rlim_max = val;
- if ((opts & OPT_soft) || opts == 0)
+ if (opts & OPT_soft)
limit.rlim_cur = val;
//bb_error_msg("setrlimit(%d, %lld, %lld)", l->cmd, (long long)limit.rlim_cur, (long long)limit.rlim_max);
if (setrlimit(l->cmd, &limit) < 0) {