aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-26 12:11:32 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-26 12:11:32 +0000
commitb1ece3dd60f0177267b4575d68730ad714a5f198 (patch)
tree9d4745b7528d677e7dc5979c0592a8253fb3908b
parentbaf447acf774d8a9d0351a84418036502e73b2c1 (diff)
downloadbusybox-w32-b1ece3dd60f0177267b4575d68730ad714a5f198.tar.gz
busybox-w32-b1ece3dd60f0177267b4575d68730ad714a5f198.tar.bz2
busybox-w32-b1ece3dd60f0177267b4575d68730ad714a5f198.zip
bother. unrevert my fix.
git-svn-id: svn://busybox.net/trunk/busybox@9024 69ca8d6d-28ef-0310-b511-8ec308f3f277
-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 f5ac500fa..e6b5fc995 100644
--- a/libbb/process_escape_sequence.c
+++ b/libbb/process_escape_sequence.c
@@ -22,35 +22,42 @@
22 * 22 *
23 */ 23 */
24 24
25#include <string.h>
25#include <stdio.h> 26#include <stdio.h>
26#include <limits.h> 27#include <limits.h>
28#include <ctype.h>
27#include "libbb.h" 29#include "libbb.h"
28 30
31#define isodigit(c) ((c) >= '0' && (c) <= '7')
32#define hextobin(c) ((c)>='a'&&(c)<='f' ? (c)-'a'+10 : (c)>='A'&&(c)<='F' ? (c)-'A'+10 : (c)-'0')
33#define octtobin(c) ((c) - '0')
29char bb_process_escape_sequence(const char **ptr) 34char bb_process_escape_sequence(const char **ptr)
30{ 35{
36 const char *p, *q;
37 unsigned int num_digits, r, n, hexescape;
31 static const char charmap[] = { 38 static const char charmap[] = {
32 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', 0, 39 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', 0,
33 '\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '\\' }; 40 '\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '\\' };
34 41
35 const char *p; 42 n = r = hexescape = num_digits = 0;
36 const char *q;
37 unsigned int num_digits;
38 unsigned int r;
39 unsigned int n;
40
41 n = 0;
42 q = *ptr; 43 q = *ptr;
43 44
44 num_digits = 0; 45 if (*q == 'x') {
46 hexescape++;
47 ++q;
48 }
49
45 do { 50 do {
46 if (((unsigned int)(*q - '0')) <= 7) { 51 if (hexescape && isxdigit(*q)) {
47 r = n * 8 + (*q - '0'); 52 r = n * 16 + hextobin(*q);
48 if (r <= UCHAR_MAX) { 53 } else if (isodigit(*q)) {
49 n = r; 54 r = n * 8 + octtobin(*q);
50 ++q; 55 }
51 if (++num_digits < 3) { 56 if (r <= UCHAR_MAX) {
52 continue; 57 n = r;
53 } 58 ++q;
59 if (++num_digits < 3) {
60 continue;
54 } 61 }
55 } 62 }
56 break; 63 break;
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 276ca5f22..ff6e58acd 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -565,7 +565,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
565 int result = 0; 565 int result = 0;
566 if (execable("/sbin/udhcpc")) { 566 if (execable("/sbin/udhcpc")) {
567 execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); 567 execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
568 execute("kill -TERM `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); 568 execute("kill -9 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
569 } else if (execable("/sbin/pump")) { 569 } else if (execable("/sbin/pump")) {
570 result = execute("pump -i %iface% -k", ifd, exec); 570 result = execute("pump -i %iface% -k", ifd, exec);
571 } else if (execable("/sbin/dhclient")) { 571 } else if (execable("/sbin/dhclient")) {
@@ -573,6 +573,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
573 } else if (execable("/sbin/dhcpcd")) { 573 } else if (execable("/sbin/dhcpcd")) {
574 result = execute("dhcpcd -k %iface%", ifd, exec); 574 result = execute("dhcpcd -k %iface%", ifd, exec);
575 } 575 }
576 static_down(ifd, exec)
576 return (result || bootp_down(ifd, exec)); 577 return (result || bootp_down(ifd, exec));
577} 578}
578 579