From 12ee64c8a3828e9dfd11ad36f3f71cb76040a99c Mon Sep 17 00:00:00 2001 From: Jaromir Capik Date: Thu, 14 Feb 2013 13:55:51 +0100 Subject: [PATCH] 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. --- pmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pmap.c b/pmap.c index cd7c43f1..79c17b2b 100644 --- a/pmap.c +++ b/pmap.c @@ -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++;