From 6735733eebb277c9d480f143f8ed2d99f351fe15 Mon Sep 17 00:00:00 2001 From: Tharre Date: Sat, 13 Jun 2015 13:24:49 +0200 Subject: Fix waitpid() error message and 2 if statements --- src/build.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2