diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-19 04:05:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-19 04:05:28 +0000 |
commit | fc9fc1f9292861cd1621d884338a766289acdf4a (patch) | |
tree | 0a2b0dd81d994e73f77174665dfb3e68e611471e | |
parent | 74f8208f1896ceb2828a84d93999584a8407565b (diff) | |
download | busybox-w32-fc9fc1f9292861cd1621d884338a766289acdf4a.tar.gz busybox-w32-fc9fc1f9292861cd1621d884338a766289acdf4a.tar.bz2 busybox-w32-fc9fc1f9292861cd1621d884338a766289acdf4a.zip |
apply all post 1.10.0 fixes
bump version to 1.10.1
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | coreutils/tail.c | 22 | ||||
-rw-r--r-- | init/init.c | 47 | ||||
-rw-r--r-- | miscutils/less.c | 11 | ||||
-rw-r--r-- | miscutils/taskset.c | 5 | ||||
-rw-r--r-- | networking/nameif.c | 46 | ||||
-rw-r--r-- | networking/tcpudp.c | 6 | ||||
-rw-r--r-- | networking/udhcp/clientsocket.c | 2 | ||||
-rw-r--r-- | procps/fuser.c | 10 | ||||
-rw-r--r-- | procps/top.c | 7 | ||||
-rw-r--r-- | testsuite/tail/tail-n-works | 8 | ||||
-rw-r--r-- | testsuite/tail/tail-works | 8 | ||||
-rwxr-xr-x | testsuite/taskset.tests | 4 |
13 files changed, 99 insertions, 79 deletions
@@ -1,6 +1,6 @@ | |||
1 | VERSION = 1 | 1 | VERSION = 1 |
2 | PATCHLEVEL = 10 | 2 | PATCHLEVEL = 10 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 1 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION = |
5 | NAME = Unnamed | 5 | NAME = Unnamed |
6 | 6 | ||
diff --git a/coreutils/tail.c b/coreutils/tail.c index 35b25a416..2f997a9f6 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -163,8 +163,6 @@ int tail_main(int argc, char **argv) | |||
163 | fmt = header_fmt + 1; /* Skip header leading newline on first output. */ | 163 | fmt = header_fmt + 1; /* Skip header leading newline on first output. */ |
164 | i = 0; | 164 | i = 0; |
165 | do { | 165 | do { |
166 | off_t current; | ||
167 | |||
168 | if (nfiles > header_threshhold) { | 166 | if (nfiles > header_threshhold) { |
169 | tail_xprint_header(fmt, argv[i]); | 167 | tail_xprint_header(fmt, argv[i]); |
170 | fmt = header_fmt; | 168 | fmt = header_fmt; |
@@ -173,19 +171,17 @@ int tail_main(int argc, char **argv) | |||
173 | /* Optimizing count-bytes case if the file is seekable. | 171 | /* Optimizing count-bytes case if the file is seekable. |
174 | * Beware of backing up too far. | 172 | * Beware of backing up too far. |
175 | * Also we exclude files with size 0 (because of /proc/xxx) */ | 173 | * Also we exclude files with size 0 (because of /proc/xxx) */ |
176 | current = lseek(fds[i], 0, SEEK_END); | 174 | if (COUNT_BYTES && !from_top) { |
177 | if (current > 0) { | 175 | off_t current = lseek(fds[i], 0, SEEK_END); |
178 | if (!from_top) { | 176 | if (current > 0) { |
179 | if (count == 0) | 177 | if (count == 0) |
180 | continue; /* showing zero lines is easy :) */ | 178 | continue; /* showing zero lines is easy :) */ |
181 | if (COUNT_BYTES) { | 179 | current -= count; |
182 | current -= count; | 180 | if (current < 0) |
183 | if (current < 0) | 181 | current = 0; |
184 | current = 0; | 182 | xlseek(fds[i], current, SEEK_SET); |
185 | xlseek(fds[i], current, SEEK_SET); | 183 | bb_copyfd_size(fds[i], STDOUT_FILENO, count); |
186 | bb_copyfd_size(fds[i], STDOUT_FILENO, count); | 184 | continue; |
187 | continue; | ||
188 | } | ||
189 | } | 185 | } |
190 | } | 186 | } |
191 | 187 | ||
diff --git a/init/init.c b/init/init.c index c4674a55f..a6c73e3fd 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -33,14 +33,15 @@ | |||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /* Allowed init action types */ | 35 | /* Allowed init action types */ |
36 | #define SYSINIT 0x001 | 36 | #define SYSINIT 0x01 |
37 | #define RESPAWN 0x002 | 37 | #define RESPAWN 0x02 |
38 | #define ASKFIRST 0x004 | 38 | /* like respawn, but wait for <Enter> to be pressed on tty: */ |
39 | #define WAIT 0x008 | 39 | #define ASKFIRST 0x04 |
40 | #define ONCE 0x010 | 40 | #define WAIT 0x08 |
41 | #define CTRLALTDEL 0x020 | 41 | #define ONCE 0x10 |
42 | #define SHUTDOWN 0x040 | 42 | #define CTRLALTDEL 0x20 |
43 | #define RESTART 0x080 | 43 | #define SHUTDOWN 0x40 |
44 | #define RESTART 0x80 | ||
44 | 45 | ||
45 | #define STR_SYSINIT "\x01" | 46 | #define STR_SYSINIT "\x01" |
46 | #define STR_RESPAWN "\x02" | 47 | #define STR_RESPAWN "\x02" |
@@ -372,7 +373,10 @@ static pid_t run(const struct init_action *a) | |||
372 | sigemptyset(&nmask); | 373 | sigemptyset(&nmask); |
373 | sigaddset(&nmask, SIGCHLD); | 374 | sigaddset(&nmask, SIGCHLD); |
374 | sigprocmask(SIG_BLOCK, &nmask, &omask); | 375 | sigprocmask(SIG_BLOCK, &nmask, &omask); |
375 | pid = vfork(); | 376 | if (BB_MMU && (a->action_type & ASKFIRST)) |
377 | pid = fork(); | ||
378 | else | ||
379 | pid = vfork(); | ||
376 | sigprocmask(SIG_SETMASK, &omask, NULL); | 380 | sigprocmask(SIG_SETMASK, &omask, NULL); |
377 | 381 | ||
378 | if (pid < 0) | 382 | if (pid < 0) |
@@ -447,7 +451,8 @@ static pid_t run(const struct init_action *a) | |||
447 | } | 451 | } |
448 | #endif | 452 | #endif |
449 | 453 | ||
450 | /* NB: on NOMMU we can't wait for input in child */ | 454 | /* NB: on NOMMU we can't wait for input in child, so |
455 | * "askfirst" will work the same as "respawn". */ | ||
451 | if (BB_MMU && (a->action_type & ASKFIRST)) { | 456 | if (BB_MMU && (a->action_type & ASKFIRST)) { |
452 | static const char press_enter[] ALIGN1 = | 457 | static const char press_enter[] ALIGN1 = |
453 | #ifdef CUSTOMIZED_BANNER | 458 | #ifdef CUSTOMIZED_BANNER |
@@ -499,7 +504,7 @@ static void run_actions(int action_type) | |||
499 | 504 | ||
500 | for (a = init_action_list; a; a = tmp) { | 505 | for (a = init_action_list; a; a = tmp) { |
501 | tmp = a->next; | 506 | tmp = a->next; |
502 | if (a->action_type == action_type) { | 507 | if (a->action_type & action_type) { |
503 | // Pointless: run() will error out if open of device fails. | 508 | // Pointless: run() will error out if open of device fails. |
504 | ///* a->terminal of "" means "init's console" */ | 509 | ///* a->terminal of "" means "init's console" */ |
505 | //if (a->terminal[0] && access(a->terminal, R_OK | W_OK)) { | 510 | //if (a->terminal[0] && access(a->terminal, R_OK | W_OK)) { |
@@ -784,6 +789,7 @@ static void parse_inittab(void) | |||
784 | fclose(file); | 789 | fclose(file); |
785 | } | 790 | } |
786 | 791 | ||
792 | #if ENABLE_FEATURE_USE_INITTAB | ||
787 | static void reload_signal(int sig ATTRIBUTE_UNUSED) | 793 | static void reload_signal(int sig ATTRIBUTE_UNUSED) |
788 | { | 794 | { |
789 | struct init_action *a, *tmp; | 795 | struct init_action *a, *tmp; |
@@ -827,8 +833,9 @@ static void reload_signal(int sig ATTRIBUTE_UNUSED) | |||
827 | delete_init_action(a); | 833 | delete_init_action(a); |
828 | } | 834 | } |
829 | } | 835 | } |
830 | run_actions(RESPAWN); | 836 | run_actions(RESPAWN | ASKFIRST); |
831 | } | 837 | } |
838 | #endif | ||
832 | 839 | ||
833 | int init_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 840 | int init_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
834 | int init_main(int argc ATTRIBUTE_UNUSED, char **argv) | 841 | int init_main(int argc ATTRIBUTE_UNUSED, char **argv) |
@@ -952,18 +959,16 @@ int init_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
952 | run_actions(ONCE); | 959 | run_actions(ONCE); |
953 | 960 | ||
954 | /* Redefine SIGHUP to reread /etc/inittab */ | 961 | /* Redefine SIGHUP to reread /etc/inittab */ |
955 | if (ENABLE_FEATURE_USE_INITTAB) | 962 | #if ENABLE_FEATURE_USE_INITTAB |
956 | signal(SIGHUP, reload_signal); | 963 | signal(SIGHUP, reload_signal); |
957 | else | 964 | #else |
958 | signal(SIGHUP, SIG_IGN); | 965 | signal(SIGHUP, SIG_IGN); |
966 | #endif | ||
959 | 967 | ||
960 | /* Now run the looping stuff for the rest of forever */ | 968 | /* Now run the looping stuff for the rest of forever */ |
961 | while (1) { | 969 | while (1) { |
962 | /* run the respawn stuff */ | 970 | /* run the respawn/askfirst stuff */ |
963 | run_actions(RESPAWN); | 971 | run_actions(RESPAWN | ASKFIRST); |
964 | |||
965 | /* run the askfirst stuff */ | ||
966 | run_actions(ASKFIRST); | ||
967 | 972 | ||
968 | /* Don't consume all CPU time -- sleep a bit */ | 973 | /* Don't consume all CPU time -- sleep a bit */ |
969 | sleep(1); | 974 | sleep(1); |
diff --git a/miscutils/less.c b/miscutils/less.c index 1a67ca7ce..37ec5d976 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -384,6 +384,10 @@ static void read_lines(void) | |||
384 | linepos = 0; | 384 | linepos = 0; |
385 | } /* end of "read lines until we reach cur_fline" loop */ | 385 | } /* end of "read lines until we reach cur_fline" loop */ |
386 | fill_match_lines(old_max_fline); | 386 | fill_match_lines(old_max_fline); |
387 | #if ENABLE_FEATURE_LESS_REGEXP | ||
388 | /* prevent us from being stuck in search for a match */ | ||
389 | wanted_match = -1; | ||
390 | #endif | ||
387 | #undef readbuf | 391 | #undef readbuf |
388 | } | 392 | } |
389 | 393 | ||
@@ -904,13 +908,8 @@ static void goto_match(int match) | |||
904 | match = 0; | 908 | match = 0; |
905 | /* Try to find next match if eof isn't reached yet */ | 909 | /* Try to find next match if eof isn't reached yet */ |
906 | if (match >= num_matches && eof_error > 0) { | 910 | if (match >= num_matches && eof_error > 0) { |
907 | wanted_match = match; | 911 | wanted_match = match; /* "I want to read until I see N'th match" */ |
908 | read_lines(); | 912 | read_lines(); |
909 | if (wanted_match >= num_matches) { | ||
910 | /* We still failed to find it. Prevent future | ||
911 | * read_lines() from trying... */ | ||
912 | wanted_match = num_matches - 1; | ||
913 | } | ||
914 | } | 913 | } |
915 | if (num_matches) { | 914 | if (num_matches) { |
916 | normalize_match_pos(match); | 915 | normalize_match_pos(match); |
diff --git a/miscutils/taskset.c b/miscutils/taskset.c index 6247aa869..bf98ea15d 100644 --- a/miscutils/taskset.c +++ b/miscutils/taskset.c | |||
@@ -50,6 +50,11 @@ int taskset_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
50 | char *pid_str; | 50 | char *pid_str; |
51 | char *aff = aff; /* for compiler */ | 51 | char *aff = aff; /* for compiler */ |
52 | 52 | ||
53 | /* NB: we mimic util-linux's taskset: -p does not take | ||
54 | * an argument, i.e., "-pN" is NOT valid, only "-p N"! | ||
55 | * Indeed, util-linux-2.13-pre7 uses: | ||
56 | * getopt_long(argc, argv, "+pchV", ...), not "...p:..." */ | ||
57 | |||
53 | opt_complementary = "-1"; /* at least 1 arg */ | 58 | opt_complementary = "-1"; /* at least 1 arg */ |
54 | opt_p = getopt32(argv, "+p"); | 59 | opt_p = getopt32(argv, "+p"); |
55 | argv += optind; | 60 | argv += optind; |
diff --git a/networking/nameif.c b/networking/nameif.c index 43388ab32..afc88917e 100644 --- a/networking/nameif.c +++ b/networking/nameif.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Written 2000 by Andi Kleen. | 5 | * Written 2000 by Andi Kleen. |
6 | * Busybox port 2002 by Nick Fedchik <nick@fedchik.org.ua> | 6 | * Busybox port 2002 by Nick Fedchik <nick@fedchik.org.ua> |
7 | * Glenn McGrath | 7 | * Glenn McGrath |
8 | * Extended matching support 2008 by Nico Erfurth <masta@perlgolf.de> | ||
8 | * | 9 | * |
9 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 10 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
10 | */ | 11 | */ |
@@ -93,12 +94,10 @@ static void nameif_parse_selector(ethtable_t *ch, char *selector) | |||
93 | found_selector++; | 94 | found_selector++; |
94 | } else { | 95 | } else { |
95 | #endif | 96 | #endif |
96 | lmac = ether_aton(selector + (strncmp(selector, "mac=", 4) == 0 ? 4 : 0)); | 97 | lmac = xmalloc(ETH_ALEN); |
97 | /* Check ascii selector, convert and copy to *mac */ | 98 | ch->mac = ether_aton_r(selector + (strncmp(selector, "mac=", 4) ? 0 : 4), lmac); |
98 | if (lmac == NULL) | 99 | if (ch->mac == NULL) |
99 | bb_error_msg_and_die("cannot parse %s", selector); | 100 | bb_error_msg_and_die("cannot parse %s", selector); |
100 | ch->mac = xmalloc(ETH_ALEN); | ||
101 | memcpy(ch->mac, lmac, ETH_ALEN); | ||
102 | #if ENABLE_FEATURE_NAMEIF_EXTENDED | 101 | #if ENABLE_FEATURE_NAMEIF_EXTENDED |
103 | found_selector++; | 102 | found_selector++; |
104 | }; | 103 | }; |
@@ -115,7 +114,7 @@ static void prepend_new_eth_table(ethtable_t **clist, char *ifname, char *select | |||
115 | if (strlen(ifname) >= IF_NAMESIZE) | 114 | if (strlen(ifname) >= IF_NAMESIZE) |
116 | bb_error_msg_and_die("interface name '%s' too long", ifname); | 115 | bb_error_msg_and_die("interface name '%s' too long", ifname); |
117 | ch = xzalloc(sizeof(*ch)); | 116 | ch = xzalloc(sizeof(*ch)); |
118 | ch->ifname = ifname; | 117 | ch->ifname = xstrdup(ifname); |
119 | nameif_parse_selector(ch, selector); | 118 | nameif_parse_selector(ch, selector); |
120 | ch->next = *clist; | 119 | ch->next = *clist; |
121 | if (*clist) | 120 | if (*clist) |
@@ -123,6 +122,21 @@ static void prepend_new_eth_table(ethtable_t **clist, char *ifname, char *select | |||
123 | *clist = ch; | 122 | *clist = ch; |
124 | } | 123 | } |
125 | 124 | ||
125 | #if ENABLE_FEATURE_CLEAN_UP | ||
126 | static void delete_eth_table(ethtable_t *ch) | ||
127 | { | ||
128 | free(ch->ifname); | ||
129 | #if ENABLE_FEATURE_NAMEIF_EXTENDED | ||
130 | free(ch->bus_info); | ||
131 | free(ch->driver); | ||
132 | #endif | ||
133 | free(ch->mac); | ||
134 | free(ch); | ||
135 | }; | ||
136 | #else | ||
137 | void delete_eth_table(ethtable_t *ch); | ||
138 | #endif | ||
139 | |||
126 | int nameif_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 140 | int nameif_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
127 | int nameif_main(int argc, char **argv) | 141 | int nameif_main(int argc, char **argv) |
128 | { | 142 | { |
@@ -156,14 +170,13 @@ int nameif_main(int argc, char **argv) | |||
156 | char *next; | 170 | char *next; |
157 | 171 | ||
158 | line_ptr = skip_whitespace(line); | 172 | line_ptr = skip_whitespace(line); |
159 | if ((line_ptr[0] == '#') || (line_ptr[0] == '\n')) { | 173 | if ((line_ptr[0] == '#') || (line_ptr[0] == '\n')) |
160 | free(line); | 174 | goto read_next_line; |
161 | continue; | ||
162 | } | ||
163 | next = skip_non_whitespace(line_ptr); | 175 | next = skip_non_whitespace(line_ptr); |
164 | if (*next) | 176 | if (*next) |
165 | *next++ = '\0'; | 177 | *next++ = '\0'; |
166 | prepend_new_eth_table(&clist, line_ptr, next); | 178 | prepend_new_eth_table(&clist, line_ptr, next); |
179 | read_next_line: | ||
167 | free(line); | 180 | free(line); |
168 | } | 181 | } |
169 | fclose(ifh); | 182 | fclose(ifh); |
@@ -187,7 +200,7 @@ int nameif_main(int argc, char **argv) | |||
187 | 200 | ||
188 | /* Find the current interface name and copy it to ifr.ifr_name */ | 201 | /* Find the current interface name and copy it to ifr.ifr_name */ |
189 | line_ptr = skip_whitespace(line); | 202 | line_ptr = skip_whitespace(line); |
190 | *skip_non_whitespace(line_ptr) = '\0'; | 203 | *strpbrk(line_ptr, " \t\n:") = '\0'; |
191 | 204 | ||
192 | memset(&ifr, 0, sizeof(struct ifreq)); | 205 | memset(&ifr, 0, sizeof(struct ifreq)); |
193 | strncpy(ifr.ifr_name, line_ptr, sizeof(ifr.ifr_name)); | 206 | strncpy(ifr.ifr_name, line_ptr, sizeof(ifr.ifr_name)); |
@@ -230,16 +243,15 @@ int nameif_main(int argc, char **argv) | |||
230 | else | 243 | else |
231 | clist = ch->next; | 244 | clist = ch->next; |
232 | if (ch->next != NULL) | 245 | if (ch->next != NULL) |
233 | ch->next->prev = ch->prev; | 246 | ch->next->prev = ch->prev; |
234 | if (ENABLE_FEATURE_CLEAN_UP) { | 247 | if (ENABLE_FEATURE_CLEAN_UP) |
235 | free(ch->ifname); | 248 | delete_eth_table(ch); |
236 | free(ch->mac); | ||
237 | free(ch); | ||
238 | } | ||
239 | next_line: | 249 | next_line: |
240 | free(line); | 250 | free(line); |
241 | } | 251 | } |
242 | if (ENABLE_FEATURE_CLEAN_UP) { | 252 | if (ENABLE_FEATURE_CLEAN_UP) { |
253 | for (ch = clist; ch; ch = ch->next) | ||
254 | delete_eth_table(ch); | ||
243 | fclose(ifh); | 255 | fclose(ifh); |
244 | }; | 256 | }; |
245 | 257 | ||
diff --git a/networking/tcpudp.c b/networking/tcpudp.c index 5da4de505..0b604af48 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c | |||
@@ -29,10 +29,10 @@ | |||
29 | * - don't know how to retrieve ORIGDST for udp. | 29 | * - don't know how to retrieve ORIGDST for udp. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <limits.h> | ||
33 | #include <linux/netfilter_ipv4.h> /* wants <limits.h> */ | ||
34 | |||
35 | #include "libbb.h" | 32 | #include "libbb.h" |
33 | /* Wants <limits.h> etc, thus included after libbb.h: */ | ||
34 | #include <linux/netfilter_ipv4.h> | ||
35 | |||
36 | // TODO: move into this file: | 36 | // TODO: move into this file: |
37 | #include "tcpudp_perhost.h" | 37 | #include "tcpudp_perhost.h" |
38 | 38 | ||
diff --git a/networking/udhcp/clientsocket.c b/networking/udhcp/clientsocket.c index 0be661d4f..114200192 100644 --- a/networking/udhcp/clientsocket.c +++ b/networking/udhcp/clientsocket.c | |||
@@ -22,11 +22,11 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <features.h> | 24 | #include <features.h> |
25 | #include <asm/types.h> | ||
25 | #if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) | 26 | #if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) |
26 | #include <netpacket/packet.h> | 27 | #include <netpacket/packet.h> |
27 | #include <net/ethernet.h> | 28 | #include <net/ethernet.h> |
28 | #else | 29 | #else |
29 | #include <asm/types.h> | ||
30 | #include <linux/if_packet.h> | 30 | #include <linux/if_packet.h> |
31 | #include <linux/if_ether.h> | 31 | #include <linux/if_ether.h> |
32 | #endif | 32 | #endif |
diff --git a/procps/fuser.c b/procps/fuser.c index 48c9bdc1e..fd876d559 100644 --- a/procps/fuser.c +++ b/procps/fuser.c | |||
@@ -57,11 +57,11 @@ static int file_to_dev_inode(const char *filename, dev_t *dev, ino_t *inode) | |||
57 | 57 | ||
58 | static char *parse_net_arg(const char *arg, unsigned *port) | 58 | static char *parse_net_arg(const char *arg, unsigned *port) |
59 | { | 59 | { |
60 | char path[12], tproto[5]; | 60 | char path[20], tproto[5]; |
61 | 61 | ||
62 | if (sscanf(arg, "%u/%4s", port, tproto) != 2) | 62 | if (sscanf(arg, "%u/%4s", port, tproto) != 2) |
63 | return NULL; | 63 | return NULL; |
64 | sprintf(path, "net/%s", tproto); | 64 | sprintf(path, "/proc/net/%s", tproto); |
65 | if (access(path, R_OK) != 0) | 65 | if (access(path, R_OK) != 0) |
66 | return NULL; | 66 | return NULL; |
67 | return xstrdup(tproto); | 67 | return xstrdup(tproto); |
@@ -99,7 +99,7 @@ static inode_list *add_inode(inode_list *ilist, dev_t dev, ino_t inode) | |||
99 | static inode_list *scan_proc_net(const char *proto, | 99 | static inode_list *scan_proc_net(const char *proto, |
100 | unsigned port, inode_list *ilist) | 100 | unsigned port, inode_list *ilist) |
101 | { | 101 | { |
102 | char path[12], line[MAX_LINE + 1]; | 102 | char path[20], line[MAX_LINE + 1]; |
103 | char addr[128]; | 103 | char addr[128]; |
104 | ino_t tmp_inode; | 104 | ino_t tmp_inode; |
105 | dev_t tmp_dev; | 105 | dev_t tmp_dev; |
@@ -109,7 +109,7 @@ static inode_list *scan_proc_net(const char *proto, | |||
109 | 109 | ||
110 | tmp_dev = find_socket_dev(); | 110 | tmp_dev = find_socket_dev(); |
111 | 111 | ||
112 | sprintf(path, "net/%s", proto); | 112 | sprintf(path, "/proc/net/%s", proto); |
113 | f = fopen(path, "r"); | 113 | f = fopen(path, "r"); |
114 | if (!f) | 114 | if (!f) |
115 | return ilist; | 115 | return ilist; |
@@ -314,8 +314,6 @@ Find processes which use FILEs or PORTs | |||
314 | opt = getopt32(argv, OPTION_STRING); | 314 | opt = getopt32(argv, OPTION_STRING); |
315 | argv += optind; | 315 | argv += optind; |
316 | 316 | ||
317 | xchdir("/proc"); | ||
318 | |||
319 | ilist = NULL; | 317 | ilist = NULL; |
320 | pp = argv; | 318 | pp = argv; |
321 | while (*pp) { | 319 | while (*pp) { |
diff --git a/procps/top.c b/procps/top.c index e3f91c8f9..206f9e8be 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -861,17 +861,22 @@ int top_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
861 | #else | 861 | #else |
862 | qsort(top, ntop, sizeof(top_status_t), (void*)(sort_function[0])); | 862 | qsort(top, ntop, sizeof(top_status_t), (void*)(sort_function[0])); |
863 | #endif /* FEATURE_TOP_CPU_USAGE_PERCENTAGE */ | 863 | #endif /* FEATURE_TOP_CPU_USAGE_PERCENTAGE */ |
864 | } else { /* TOPMEM */ | 864 | } |
865 | #if ENABLE_FEATURE_TOPMEM | ||
866 | else { /* TOPMEM */ | ||
865 | qsort(topmem, ntop, sizeof(topmem_status_t), (void*)topmem_sort); | 867 | qsort(topmem, ntop, sizeof(topmem_status_t), (void*)topmem_sort); |
866 | } | 868 | } |
869 | #endif | ||
867 | count = lines; | 870 | count = lines; |
868 | if (OPT_BATCH_MODE || count > ntop) { | 871 | if (OPT_BATCH_MODE || count > ntop) { |
869 | count = ntop; | 872 | count = ntop; |
870 | } | 873 | } |
871 | if (scan_mask == TOP_MASK) | 874 | if (scan_mask == TOP_MASK) |
872 | display_process_list(count, col); | 875 | display_process_list(count, col); |
876 | #if ENABLE_FEATURE_TOPMEM | ||
873 | else | 877 | else |
874 | display_topmem_process_list(count, col); | 878 | display_topmem_process_list(count, col); |
879 | #endif | ||
875 | clearmems(); | 880 | clearmems(); |
876 | if (iterations >= 0 && !--iterations) | 881 | if (iterations >= 0 && !--iterations) |
877 | break; | 882 | break; |
diff --git a/testsuite/tail/tail-n-works b/testsuite/tail/tail-n-works index 27a905f88..e5b260caf 100644 --- a/testsuite/tail/tail-n-works +++ b/testsuite/tail/tail-n-works | |||
@@ -1,4 +1,4 @@ | |||
1 | [ -n "$d" ] || d=.. | 1 | echo -ne "abc\ndef\n123\n" >input |
2 | tail -n 2 "$d/README" > logfile.gnu | 2 | echo -ne "def\n123\n" >logfile.ok |
3 | busybox tail -n 2 "$d/README" > logfile.bb | 3 | busybox tail -n 2 input > logfile.bb |
4 | cmp logfile.gnu logfile.bb | 4 | cmp logfile.ok logfile.bb |
diff --git a/testsuite/tail/tail-works b/testsuite/tail/tail-works index 27a905f88..64e6d88ab 100644 --- a/testsuite/tail/tail-works +++ b/testsuite/tail/tail-works | |||
@@ -1,4 +1,4 @@ | |||
1 | [ -n "$d" ] || d=.. | 1 | echo -ne "abc\ndef\n123\n" >input |
2 | tail -n 2 "$d/README" > logfile.gnu | 2 | echo -ne "def\n123\n" >logfile.ok |
3 | busybox tail -n 2 "$d/README" > logfile.bb | 3 | busybox tail -2 input > logfile.bb |
4 | cmp logfile.gnu logfile.bb | 4 | cmp logfile.ok logfile.bb |
diff --git a/testsuite/taskset.tests b/testsuite/taskset.tests index 6001c3e32..a3757ab5b 100755 --- a/testsuite/taskset.tests +++ b/testsuite/taskset.tests | |||
@@ -7,8 +7,8 @@ | |||
7 | a="taskset" | 7 | a="taskset" |
8 | 8 | ||
9 | # testing "test name" "opts" "expected result" "file inp" "stdin" | 9 | # testing "test name" "opts" "expected result" "file inp" "stdin" |
10 | testing "taskset (get from pid 1)" "$a -p1 >/dev/null;echo \$?" "0\n" "" "" | 10 | testing "taskset (get from pid 1)" "$a -p 1 >/dev/null;echo \$?" "0\n" "" "" |
11 | testing "taskset (invalid pid)" "$a -p0 >/dev/null 2>&1;echo \$?" "1\n" "" "" | 11 | testing "taskset (invalid pid)" "$a -p 0 >/dev/null 2>&1;echo \$?" "1\n" "" "" |
12 | testing "taskset (set_aff, needs CAP_SYS_NICE)" \ | 12 | testing "taskset (set_aff, needs CAP_SYS_NICE)" \ |
13 | "$a 0x1 $SHELL -c $a\ -p\ \$$\|grep\ \"current\ affinity\ mask:\ 1\" >/dev/null;echo \$?" \ | 13 | "$a 0x1 $SHELL -c $a\ -p\ \$$\|grep\ \"current\ affinity\ mask:\ 1\" >/dev/null;echo \$?" \ |
14 | "0\n" "" "" | 14 | "0\n" "" "" |