libbb: fix mishandling of "all argv are opts" in getopt32()

function                                             old     new   delta
top_main                                            1100    1095      -5
getopt32                                            1398    1361     -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-42)             Total: -42 bytes
This commit is contained in:
Denis Vlasenko
2008-08-20 00:12:22 +00:00
parent 6c4eb44113
commit 1c45a505eb
2 changed files with 25 additions and 42 deletions

View File

@@ -763,8 +763,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
/* all args are options; -n NUM */
opt_complementary = "-:n+";
getopt32(argv, "d:n:b", &sinterval, &iterations);
if (option_mask32 & OPT_d) {
if (getopt32(argv, "d:n:b", &sinterval, &iterations) & OPT_d) {
/* Need to limit it to not overflow poll timeout */
interval = xatou16(sinterval); // -d
}