summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2004-07-26 12:11:32 +0000
committerEric Andersen2004-07-26 12:11:32 +0000
commitb2a300590d1e061658be5aa4f74a437485b36a55 (patch)
tree9d4745b7528d677e7dc5979c0592a8253fb3908b
parent8f38782a6e797c4b5c322e0b6a4ec6d369822c6a (diff)
downloadbusybox-b2a300590d1e061658be5aa4f74a437485b36a55.zip
busybox-b2a300590d1e061658be5aa4f74a437485b36a55.tar.gz
bother. unrevert my fix.
-rw-r--r--libbb/process_escape_sequence.c39
-rw-r--r--networking/ifupdown.c3
2 files changed, 25 insertions, 17 deletions
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c
index f5ac500..e6b5fc9 100644
--- a/libbb/process_escape_sequence.c
+++ b/libbb/process_escape_sequence.c
@@ -22,35 +22,42 @@
*
*/
+#include <string.h>
#include <stdio.h>
#include <limits.h>
+#include <ctype.h>
#include "libbb.h"
+#define isodigit(c) ((c) >= '0' && (c) <= '7')
+#define hextobin(c) ((c)>='a'&&(c)<='f' ? (c)-'a'+10 : (c)>='A'&&(c)<='F' ? (c)-'A'+10 : (c)-'0')
+#define octtobin(c) ((c) - '0')
char bb_process_escape_sequence(const char **ptr)
{
+ const char *p, *q;
+ unsigned int num_digits, r, n, hexescape;
static const char charmap[] = {
'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', 0,
'\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '\\' };
- const char *p;
- const char *q;
- unsigned int num_digits;
- unsigned int r;
- unsigned int n;
-
- n = 0;
+ n = r = hexescape = num_digits = 0;
q = *ptr;
- num_digits = 0;
+ if (*q == 'x') {
+ hexescape++;
+ ++q;
+ }
+
do {
- if (((unsigned int)(*q - '0')) <= 7) {
- r = n * 8 + (*q - '0');
- if (r <= UCHAR_MAX) {
- n = r;
- ++q;
- if (++num_digits < 3) {
- continue;
- }
+ if (hexescape && isxdigit(*q)) {
+ r = n * 16 + hextobin(*q);
+ } else if (isodigit(*q)) {
+ r = n * 8 + octtobin(*q);
+ }
+ if (r <= UCHAR_MAX) {
+ n = r;
+ ++q;
+ if (++num_digits < 3) {
+ continue;
}
}
break;
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 276ca5f..ff6e58a 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -565,7 +565,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
int result = 0;
if (execable("/sbin/udhcpc")) {
execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
- execute("kill -TERM `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+ execute("kill -9 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
} else if (execable("/sbin/pump")) {
result = execute("pump -i %iface% -k", ifd, exec);
} else if (execable("/sbin/dhclient")) {
@@ -573,6 +573,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
} else if (execable("/sbin/dhcpcd")) {
result = execute("dhcpcd -k %iface%", ifd, exec);
}
+ static_down(ifd, exec)
return (result || bootp_down(ifd, exec));
}