pmap: fixing pidlist allocation & disabling vmflags in -X

This commit fixes allocation of the pid list so that it
is sufficient for storing the list terminator.

Additionally the vmflags printing in the -X mode is disabled
because it's too long. From now the vmflags are displayed
in the -XX mode only.
This commit is contained in:
Jaromir Capik 2013-02-14 13:55:51 +01:00
parent d454bfe902
commit 12ee64c8a3

6
pmap.c
View File

@ -334,7 +334,7 @@ loop_end:
printf(fmt_str, listnode->description);
}
if (has_vmflags) {
if (has_vmflags && X_option > 1) {
sprintf(fmt_str, " %%%ds", maxwv);
printf(fmt_str, "VmFlags");
}
@ -352,7 +352,7 @@ loop_end:
printf(fmt_str, listnode->value_str);
}
if (has_vmflags) {
if (has_vmflags && X_option > 1) {
sprintf(fmt_str, " %%%ds", maxwv);
printf(fmt_str, vmflags);
}
@ -709,7 +709,7 @@ int main(int argc, char **argv)
x_option && (d_option || X_option))
xerrx(EXIT_FAILURE, _("options -d, -x, -X are mutually exclusive"));
pidlist = xmalloc(sizeof(pid_t) * argc);
pidlist = xmalloc(sizeof(pid_t) * (argc+1));
while (*argv) {
char *walk = *argv++;