diff options
author | Jaromir Capik <jcapik@redhat.com> | 2013-02-14 13:55:51 +0100 |
---|---|---|
committer | Jaromir Capik <jcapik@redhat.com> | 2013-02-15 18:51:28 +0100 |
commit | 12ee64c8a3828e9dfd11ad36f3f71cb76040a99c (patch) | |
tree | 788df2f3f0dc13d28de40a138af248b354944348 | |
parent | d454bfe9025d89ad888d4de9e741dc8f95c22b9c (diff) | |
download | procps-ng-12ee64c8a3828e9dfd11ad36f3f71cb76040a99c.tar.gz |
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.
-rw-r--r-- | pmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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++; |