lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <AANLkTimHw3VhnTj4P9s3RgEUiyqsTHdSmSimBVGvS-g4@mail.gmail.com>
Date:	Tue, 5 Oct 2010 11:26:38 +0800
From:	jovi zhang <bookjovi@...il.com>
To:	Arnaldo Carvalho de Melo <acme@...radead.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] perf: fix not exit when fork error

fix one bug(not exit when fork error in builtin-stat.c), also unify
some exit code usage.

Signed-off-by: jovi zhang <bookjovi@...il.com>
tools/perf/builtin-stat.c |    7 +++++--
tools/perf/builtin-top.c  |    6 +++---
tools/perf/perf.c         |    4 ++--
3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a6b4d44..fe3e044 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -285,12 +285,15 @@ static int run_perf_stat(int argc __used, const
char **argv)

      if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) {
              perror("failed to create pipes");
-               exit(1);
+               exit(-1);
      }

      if (forks) {
-               if ((child_pid = fork()) < 0)
+               child_pid = fork();
+               if (child_pid < 0) {
                      perror("failed to fork");
+                       exit(-1);
+               }

              if (!child_pid) {
                      close(child_ready_pipe[0]);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index b513e40..d0e646c 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1047,7 +1047,7 @@ static void event__process_sample(const event_t *self,
                  RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION])) {
                      pr_err("The %s file can't be used\n",
                             symbol_conf.vmlinux_name);
-                       exit(1);
+                       exit(-1);
              }

              return;
@@ -1066,7 +1066,7 @@ static void event__process_sample(const event_t *self,
                              machine__fprintf_vmlinux_path(machine, stderr);
                      } else
                              pr_err(".\n");
-                       exit(1);
+                       exit(-1);
              }
      }

@@ -1439,7 +1439,7 @@ int cmd_top(int argc, const char **argv, const
char *prefix __used)
              default_interval = freq;
      } else {
              fprintf(stderr, "frequency and count are zero, aborting\n");
-               exit(EXIT_FAILURE);
+               exit(-1);
      }

      /*
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index cdd6c03..2d4601f 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -468,7 +468,7 @@ int main(int argc, const char **argv)
              printf("\n usage: %s\n\n", perf_usage_string);
              list_common_cmds_help();
              printf("\n %s\n\n", perf_more_info_string);
-               exit(1);
+               exit(-1);
      }
      cmd = argv[0];

@@ -492,7 +492,7 @@ int main(int argc, const char **argv)
                      fprintf(stderr, "Expansion of alias '%s' failed; "
                              "'%s' is not a perf-command\n",
                              cmd, argv[0]);
-                       exit(1);
+                       exit(-1);
              }
              if (!done_help) {
                      cmd = argv[0] = help_unknown_cmd(cmd);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ