summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-07-17 08:06:20 -0400
committerColin Walters <walters@verbum.org>2012-07-17 08:06:20 -0400
commitc8d7fc216d79419e194168656bf75731c88cdd7d (patch)
tree369d310d917c4fa06d0ef9185014a5b062a8cd38
parent6b31c580caae98a4d796be6239b7b73901f99f31 (diff)
downloadostree-c8d7fc216d79419e194168656bf75731c88cdd7d.tar.gz
core: Use g_spawn_check_exit_status()
-rw-r--r--src/libotutil/ot-spawn-utils.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/libotutil/ot-spawn-utils.c b/src/libotutil/ot-spawn-utils.c
index 1dab0142..e1256614 100644
--- a/src/libotutil/ot-spawn-utils.c
+++ b/src/libotutil/ot-spawn-utils.c
@@ -25,7 +25,6 @@
#include "otutil.h"
#include <string.h>
-#include <sys/wait.h>
gboolean
ot_spawn_sync_checked (const char *cwd,
@@ -50,27 +49,8 @@ ot_spawn_sync_checked (const char *cwd,
error))
goto out;
- if (WIFEXITED (exit_status))
- {
- if (WEXITSTATUS (exit_status) != 0)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Exited with code %d", WEXITSTATUS (exit_status));
- goto out;
- }
- }
- else if (WIFSIGNALED (exit_status))
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Killed by signal %d", WTERMSIG (exit_status));
- goto out;
- }
- else
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Exited abnormally");
- goto out;
- }
+ if (!g_spawn_check_exit_status (exit_status, error))
+ goto out;
ret = TRUE;
out: