aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2015-06-13 13:24:49 +0200
committerTharre <tharre3@gmail.com>2015-06-13 13:24:49 +0200
commit6735733eebb277c9d480f143f8ed2d99f351fe15 (patch)
treed33c5e8bc76944c69d1e5609a53664585e0ac936
parent651653dddbc28d58dc1dac9978c126907b5ca0c0 (diff)
downloadredo-6735733eebb277c9d480f143f8ed2d99f351fe15.tar.gz
redo-6735733eebb277c9d480f143f8ed2d99f351fe15.tar.xz
redo-6735733eebb277c9d480f143f8ed2d99f351fe15.zip
Fix waitpid() error message and 2 if statements
-rw-r--r--src/build.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/build.c b/src/build.c
index 5645bf3..f4def6a 100644
--- a/src/build.c
+++ b/src/build.c
@@ -97,9 +97,8 @@ static int build_target(const char *dep) {
}
/* remove old dependency record */
- if (remove(dep.path))
- if (errno != ENOENT)
- fatal("redo: failed to remove %s", dep.path);
+ if (remove(dep.path) && errno != ENOENT)
+ fatal("redo: failed to remove %s", dep->path);
char *temp_output = concat(2, target, ".redoing.tmp");
@@ -139,7 +138,7 @@ static int build_target(const char *dep) {
/* parent */
int status;
if (waitpid(pid, &status, 0) == -1)
- fatal("waitpid() failed: ");
+ fatal("redo: waitpid() failed");
/* check how our child exited */
if (WIFEXITED(status)) {
@@ -164,9 +163,8 @@ static int build_target(const char *dep) {
write_dep_header(&dep);
} else {
- if (remove(temp_output))
- if (errno != ENOENT)
- fatal("redo: failed to remove %s", temp_output);
+ if (remove(temp_output) && errno != ENOENT)
+ fatal("redo: failed to remove %s", temp_output);
}
free(dep.path);