ash: in tryexec(), ensure we don't try to run embedded scripts as applets
[oweals/busybox.git] / procps / pmap.c
index bb5f9e7c2172c29eb06b4592d6e4691cd986da39..c8fa0d28064bc614acc7f8e048cfc795a4a4b644 100644 (file)
@@ -7,23 +7,23 @@
  * Licensed under GPLv2 or later, see the LICENSE file in this source tree
  * for details.
  */
+//config:config PMAP
+//config:      bool "pmap (6 kb)"
+//config:      default y
+//config:      help
+//config:      Display processes' memory mappings.
 
-//applet:IF_PMAP(APPLET(pmap, _BB_DIR_USR_BIN, _BB_SUID_DROP))
-//kbuild:lib-$(CONFIG_PMAP)     += pmap.o
+//applet:IF_PMAP(APPLET(pmap, BB_DIR_USR_BIN, BB_SUID_DROP))
 
-//config:config PMAP
-//config:       bool "pmap"
-//config:       default y
-//config:       help
-//config:         Display processes' memory mappings.
+//kbuild:lib-$(CONFIG_PMAP) += pmap.o
 
 //usage:#define pmap_trivial_usage
-//usage:       "[-x][-q] PID"
+//usage:       "[-xq] PID..."
 //usage:#define pmap_full_usage "\n\n"
-//usage:       "Display detailed precesses' memory usage\n"
-//usage:       "\nOptions:"
-//usage:       "\n     -x              show details"
-//usage:       "\n     -q              quiet"
+//usage:       "Display process memory usage"
+//usage:     "\n"
+//usage:     "\n       -x      Show details"
+//usage:     "\n       -q      Quiet"
 
 #include "libbb.h"
 
@@ -66,7 +66,7 @@ static int procps_get_maps(pid_t pid, unsigned opt)
        int ret;
        char buf[256];
 
-       read_cmdline(buf, sizeof(buf), pid, "no such process");
+       read_cmdline(buf, sizeof(buf), pid, NULL);
        printf("%u: %s\n", (int)pid, buf);
 
        if (!(opt & OPT_q) && (opt & OPT_x))
@@ -96,7 +96,7 @@ int pmap_main(int argc UNUSED_PARAM, char **argv)
        unsigned opts;
        int ret;
 
-       opts = getopt32(argv, "xq");
+       opts = getopt32(argv, "^" "xq" "\0" "-1"); /* min one arg */
        argv += optind;
 
        ret = 0;