In revision 1.14 I broke the -4 and -6 options of sockstat(1).
Using either one of the two would result in an empty protos[] array, and no sockets were actually listed: % sockstat -4 USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS % sockstat -6 USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS % Fix this bug by tweaking appropriately the logic of handling opt_4, opt_6, opt_u and protos_defined. Submitted by: des Pointy hat: keramida
This commit is contained in:
parent
9167cd6392
commit
d2d77d2aee
@ -713,17 +713,12 @@ main(int argc, char *argv[])
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
/*
|
||||
* If protos_defined remains -1, no -P was provided, so we have to
|
||||
* set up the default protocol list in protos[] first.
|
||||
*/
|
||||
if (!opt_4 && !opt_6 && !opt_u && protos_defined == -1) {
|
||||
opt_u = 1;
|
||||
protos_defined = set_default_protos();
|
||||
}
|
||||
|
||||
if (!opt_4 && !opt_6)
|
||||
if ((!opt_4 && !opt_6) && protos_defined != -1)
|
||||
opt_4 = opt_6 = 1;
|
||||
if (!opt_4 && !opt_6 && !opt_u)
|
||||
opt_4 = opt_6 = opt_u = 1;
|
||||
if ((opt_4 || opt_6) && protos_defined == -1)
|
||||
protos_defined = set_default_protos();
|
||||
if (!opt_c && !opt_l)
|
||||
opt_c = opt_l = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user