summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Despres <nicolas.despres@gmail.com>2011-04-09 17:51:21 (GMT)
committerNicolas Despres <nicolas.despres@gmail.com>2011-04-26 11:20:08 (GMT)
commitb471f2db6e79abeda1717f3f136bc369eb916958 (patch)
treecf2dd6e35c99125e25e46b78e46dcdfff9053712
parent5c192cda0788faeed93b3ba03a6830ed43762b24 (diff)
downloadNinja-b471f2db6e79abeda1717f3f136bc369eb916958.zip
Ninja-b471f2db6e79abeda1717f3f136bc369eb916958.tar.gz
Ninja-b471f2db6e79abeda1717f3f136bc369eb916958.tar.bz2
Prefix perror(3) messages with program name.
It make it easier while debugging to know who is reporting the error: Ninja itself or one of the command called by Ninja during the build process or one of the generator which called Ninja.
-rw-r--r--src/browse.cc10
-rw-r--r--src/ninja.cc2
-rw-r--r--src/parsers.cc2
-rw-r--r--src/subprocess.cc2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/browse.cc b/src/browse.cc
index db89db0..f65e537 100644
--- a/src/browse.cc
+++ b/src/browse.cc
@@ -25,13 +25,13 @@ void RunBrowsePython(State* state, const char* ninja_command) {
// (Actually the Python process becomes the parent.)
int pipefd[2];
if (pipe(pipefd) < 0) {
- perror("pipe");
+ perror("ninja: pipe");
return;
}
pid_t pid = fork();
if (pid < 0) {
- perror("fork");
+ perror("ninja: fork");
return;
}
@@ -39,7 +39,7 @@ void RunBrowsePython(State* state, const char* ninja_command) {
close(pipefd[1]);
do {
if (dup2(pipefd[0], 0) < 0) {
- perror("dup2");
+ perror("ninja: dup2");
break;
}
@@ -48,7 +48,7 @@ void RunBrowsePython(State* state, const char* ninja_command) {
"python", "-", ninja_command, NULL
};
execvp(command[0], (char**)command);
- perror("execvp");
+ perror("ninja: execvp");
} while (false);
_exit(1);
} else { // Child.
@@ -57,7 +57,7 @@ void RunBrowsePython(State* state, const char* ninja_command) {
// Write the script file into the stdin of the Python process.
ssize_t len = write(pipefd[1], kBrowsePy, sizeof(kBrowsePy));
if (len < (ssize_t)sizeof(kBrowsePy))
- perror("write");
+ perror("ninja: write");
close(pipefd[1]);
exit(0);
}
diff --git a/src/ninja.cc b/src/ninja.cc
index 5e26f6a..cd64c84 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -186,7 +186,7 @@ int main(int argc, char** argv) {
char cwd[PATH_MAX];
if (!getcwd(cwd, sizeof(cwd))) {
- perror("getcwd");
+ perror("ninja: getcwd");
return 1;
}
diff --git a/src/parsers.cc b/src/parsers.cc
index b9c1190..4aeb73c 100644
--- a/src/parsers.cc
+++ b/src/parsers.cc
@@ -291,7 +291,7 @@ bool ManifestParser::Parse(const string& input, string* err) {
// XXX remove this hack, or make it more principled.
char cwd[1024];
if (!getcwd(cwd, sizeof(cwd))) {
- perror("getcwd");
+ perror("ninja: getcwd");
return 1;
}
value = cwd + value.substr(9);
diff --git a/src/subprocess.cc b/src/subprocess.cc
index 1043e65..cef0ad3 100644
--- a/src/subprocess.cc
+++ b/src/subprocess.cc
@@ -157,7 +157,7 @@ void SubprocessSet::DoWork() {
int ret = poll(fds.data(), fds.size(), -1);
if (ret == -1) {
if (errno != EINTR)
- perror("poll");
+ perror("ninja: poll");
return;
}