diff options
author | Rob Landley <rob@landley.net> | 2006-03-09 22:21:20 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-03-09 22:21:20 +0000 |
commit | 1f305dc0fdb8415c9c1321e49cc194089e58c456 (patch) | |
tree | a176d02a50d900a5dc610266d920c5efc65c3e1e | |
parent | 3a324754f88b913091eca8970c686f2e998028a9 (diff) | |
download | busybox-w32-1f305dc0fdb8415c9c1321e49cc194089e58c456.tar.gz busybox-w32-1f305dc0fdb8415c9c1321e49cc194089e58c456.tar.bz2 busybox-w32-1f305dc0fdb8415c9c1321e49cc194089e58c456.zip |
Portability patch from rfelker. The bb_asprintf.c thing needs an eventual
follow up in platform.h to set the #ifdef, but the workaround works for
everybody, so...
-rw-r--r-- | editors/sed.c | 2 | ||||
-rw-r--r-- | include/inet_common.h | 2 | ||||
-rw-r--r-- | include/libbb.h | 1 | ||||
-rw-r--r-- | libbb/bb_asprintf.c | 10 |
4 files changed, 13 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c index 93d3f89d1..44e86e245 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -434,7 +434,7 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr) | |||
434 | while(isspace(*cmdstr)) cmdstr++; | 434 | while(isspace(*cmdstr)) cmdstr++; |
435 | length = strcspn(cmdstr, semicolon_whitespace); | 435 | length = strcspn(cmdstr, semicolon_whitespace); |
436 | if (length) { | 436 | if (length) { |
437 | sed_cmd->string = strndup(cmdstr, length); | 437 | sed_cmd->string = bb_xstrndup(cmdstr, length); |
438 | cmdstr += length; | 438 | cmdstr += length; |
439 | } | 439 | } |
440 | } | 440 | } |
diff --git a/include/inet_common.h b/include/inet_common.h index afea5deaa..f330aa90f 100644 --- a/include/inet_common.h +++ b/include/inet_common.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <features.h> | 11 | #include <features.h> |
12 | #include <sys/types.h> | 12 | #include <sys/types.h> |
13 | #include <sys/socket.h> | 13 | #include <sys/socket.h> |
14 | #include <arpa/inet.h> | 14 | #include <netinet/in.h> |
15 | 15 | ||
16 | 16 | ||
17 | extern const char bb_INET_default[]; /* = "default" */ | 17 | extern const char bb_INET_default[]; /* = "default" */ |
diff --git a/include/libbb.h b/include/libbb.h index bc3fa5990..0490ee35f 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <stdint.h> | 20 | #include <stdint.h> |
21 | 21 | ||
22 | #include <netdb.h> | 22 | #include <netdb.h> |
23 | #include <netinet/in.h> | ||
23 | 24 | ||
24 | #include <features.h> | 25 | #include <features.h> |
25 | 26 | ||
diff --git a/libbb/bb_asprintf.c b/libbb/bb_asprintf.c index 8658a5408..191417a2d 100644 --- a/libbb/bb_asprintf.c +++ b/libbb/bb_asprintf.c | |||
@@ -13,9 +13,19 @@ char *bb_xasprintf(const char *format, ...) | |||
13 | int r; | 13 | int r; |
14 | char *string_ptr; | 14 | char *string_ptr; |
15 | 15 | ||
16 | #ifdef HAVE_GNU_EXTENSIONS | ||
16 | va_start(p, format); | 17 | va_start(p, format); |
17 | r = vasprintf(&string_ptr, format, p); | 18 | r = vasprintf(&string_ptr, format, p); |
18 | va_end(p); | 19 | va_end(p); |
20 | #else | ||
21 | va_start(p, format); | ||
22 | r = vsnprintf(NULL, 0, format, p); | ||
23 | va_end(p); | ||
24 | string_ptr = xmalloc(r+1); | ||
25 | va_start(p, format); | ||
26 | r = vsnprintf(string_ptr, r+1, format, p); | ||
27 | va_end(p); | ||
28 | #endif | ||
19 | 29 | ||
20 | if (r < 0) { | 30 | if (r < 0) { |
21 | bb_perror_msg_and_die("bb_xasprintf"); | 31 | bb_perror_msg_and_die("bb_xasprintf"); |