ash: in tryexec(), ensure we don't try to run embedded scripts as applets
[oweals/busybox.git] / procps / mpstat.c
index af3263d67e67dfd446acf60296e418f6e702efa8..ed678f4562b58ebb16380ef1e27f039be5e6cada 100644 (file)
@@ -6,17 +6,17 @@
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
+//config:config MPSTAT
+//config:      bool "mpstat (10 kb)"
+//config:      default y
+//config:      help
+//config:      Per-processor statistics
 
 //applet:IF_MPSTAT(APPLET(mpstat, BB_DIR_BIN, BB_SUID_DROP))
+/* shouldn't be noexec: "mpstat INTERVAL" runs indefinitely */
 
 //kbuild:lib-$(CONFIG_MPSTAT) += mpstat.o
 
-//config:config MPSTAT
-//config:      bool "mpstat"
-//config:      default y
-//config:      help
-//config:        Per-processor statistics
-
 #include "libbb.h"
 #include <sys/utsname.h>  /* struct utsname */
 
@@ -526,7 +526,7 @@ static void get_irqs_from_stat(struct stats_irq *irq)
 
        while (fgets(buf, sizeof(buf), fp)) {
                //bb_error_msg("/proc/stat:'%s'", buf);
-               if (strncmp(buf, "intr ", 5) == 0) {
+               if (is_prefixed_with(buf, "intr ")) {
                        /* Read total number of IRQs since system boot */
                        sscanf(buf + 5, "%"FMT_DATA"u", &irq->irq_nr);
                }
@@ -840,7 +840,7 @@ static int get_irqcpu_nr(const char *f, int max_irqs)
 //usage:     "\n       -u                      Report CPU utilization"
 
 int mpstat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int mpstat_main(int UNUSED_PARAM argc, char **argv)
+int mpstat_main(int argc UNUSED_PARAM, char **argv)
 {
        char *opt_irq_fmt;
        char *opt_set_cpu;