Replace _exit(-1) with _exit(EXIT_FAILURE).
-1 is not a valid exit status.
Also replace a few exit(1) with exit(EXIT_FAILURE).
Test: mmma bootable/recovery
Change-Id: I4596c8328b770bf95acccc06a4401bd5cabd4bfd
diff --git a/adb_install.cpp b/adb_install.cpp
index fab72f8..79b8df9 100644
--- a/adb_install.cpp
+++ b/adb_install.cpp
@@ -78,7 +78,7 @@
pid_t child;
if ((child = fork()) == 0) {
execl("/sbin/recovery", "recovery", "--adbd", NULL);
- _exit(-1);
+ _exit(EXIT_FAILURE);
}
// FUSE_SIDELOAD_HOST_PATHNAME will start to exist once the host
diff --git a/install.cpp b/install.cpp
index 91e4875..ce89e0d 100644
--- a/install.cpp
+++ b/install.cpp
@@ -387,7 +387,7 @@
// the child process to hang. This deadlock results from an improperly
// copied mutex in the ui functions.
fprintf(stdout, "E:Can't run %s (%s)\n", chr_args[0], strerror(errno));
- _exit(-1);
+ _exit(EXIT_FAILURE);
}
close(pipefd[1]);
diff --git a/recovery.cpp b/recovery.cpp
index 25d3546..29d7ab8 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -243,7 +243,7 @@
if (log_fp == nullptr) {
PLOG(ERROR) << "fopen \"" << filename << "\" failed";
close(pipefd[0]);
- _exit(1);
+ _exit(EXIT_FAILURE);
}
FILE* pipe_fp = fdopen(pipefd[0], "r");
@@ -251,7 +251,7 @@
PLOG(ERROR) << "fdopen failed";
check_and_fclose(log_fp, filename);
close(pipefd[0]);
- _exit(1);
+ _exit(EXIT_FAILURE);
}
char* line = nullptr;
@@ -273,7 +273,7 @@
free(line);
check_and_fclose(log_fp, filename);
close(pipefd[0]);
- _exit(1);
+ _exit(EXIT_FAILURE);
} else {
// Redirect stdout/stderr to the logger process.
// Close the unused read end.
diff --git a/roots.cpp b/roots.cpp
index 376fcbd..4a0a494 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -163,7 +163,7 @@
pid_t child;
if ((child = vfork()) == 0) {
execv(path, argv);
- _exit(-1);
+ _exit(EXIT_FAILURE);
}
waitpid(child, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 6755d78..03ce413 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -120,7 +120,7 @@
err:
LOG(ERROR) << "failed to parse range '" << range_text << "'";
- exit(1);
+ exit(EXIT_FAILURE);
}
static bool range_overlaps(const RangeSet& r1, const RangeSet& r2) {
diff --git a/updater/install.cpp b/updater/install.cpp
index 7a8e92f..c7ecdb5 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -247,7 +247,7 @@
pid_t child;
if ((child = vfork()) == 0) {
execv(path, argv);
- _exit(-1);
+ _exit(EXIT_FAILURE);
}
int status;
@@ -1072,7 +1072,7 @@
if (child == 0) {
execv(args2[0], args2);
PLOG(ERROR) << "run_program: execv failed";
- _exit(1);
+ _exit(EXIT_FAILURE);
}
int status;