summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-06-22 11:03:41 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-06-22 11:03:41 +0000
commit5e2cf44a4d5d70f0dbed7b21257bd6d15538b3b2 (patch)
tree026f0ca4fc71c0d563a1de36b86ccad9156fc594 /src
parent84007a09588b21487cbd3869bcb26c3e2c05b605 (diff)
downloadguix-5e2cf44a4d5d70f0dbed7b21257bd6d15538b3b2.tar.gz
* Put WEXITSTATUS stuff somewhere else.
Diffstat (limited to 'src')
-rw-r--r--src/libstore/normalise.cc4
-rw-r--r--src/libstore/store.cc2
-rw-r--r--src/libutil/util.cc6
-rw-r--r--src/libutil/util.hh2
4 files changed, 11 insertions, 3 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc
index 56ce5da7d1..1632ad1fb6 100644
--- a/src/libstore/normalise.cc
+++ b/src/libstore/normalise.cc
@@ -501,7 +501,7 @@ void NormalisationGoal::buildDone()
     debug(format("builder process for `%1%' finished") % nePath);
 
     /* Check the exit status. */
-    if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+    if (!statusOk(status)) {
         deleteTmpDir(false);
         throw Error(format("builder for `%1%' %2%")
             % nePath % statusToString(status));
@@ -1371,7 +1371,7 @@ void SubstitutionGoal::finished()
     debug(format("substitute for `%1%' finished") % storePath);
 
     /* Check the exit status. */
-    if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+    if (!statusOk(status))
         throw Error(format("builder for `%1%' %2%")
             % storePath % statusToString(status));
 
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 2ec93d63bc..9677f84223 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -161,7 +161,7 @@ void copyPath(const Path & src, const Path & dst)
 
     /* Wait for the child to finish. */
     int status = pid.wait(true);
-    if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+    if (!statusOk(status))
         throw Error(format("cannot copy `%1% to `%2%': child %3%")
             % src % dst % statusToString(status));
 }
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index d4345eac36..5fb553d6dd 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -611,3 +611,9 @@ string statusToString(int status)
             return "died abnormally";
     } else return "succeeded";
 }
+
+
+bool statusOk(int status)
+{
+    return WIFEXITED(status) && WEXITSTATUS(status) == 0;
+}
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 67661eb5f8..13f28dc221 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -243,5 +243,7 @@ Strings unpackStrings(const string & s);
    error string. */
 string statusToString(int status);
 
+bool statusOk(int status);
+
 
 #endif /* !__UTIL_H */