diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-01-21 08:27:48 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-01-21 13:36:01 +0800 |
commit | 6acda62401f17924b7004e25d038533e282903a1 (patch) | |
tree | 6ae6cd982bbf2de19975b4af573b6fc6c3e3c96d | |
parent | c19e643390ef5f77151fe029e6d336a07e212858 (diff) | |
download | talos-petitboot-6acda62401f17924b7004e25d038533e282903a1.tar.gz talos-petitboot-6acda62401f17924b7004e25d038533e282903a1.zip |
discover/paths: Check process exit status when loading URLs
Currently, we may report incorrect success when loading a URL, as we
only check the return value of process_run_sync() (and not the process
exit status itself) in load_process_to_local_file.
This fix adds a check to the synchronous load.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r-- | discover/paths.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/discover/paths.c b/discover/paths.c index 5e577eb..58fbffd 100644 --- a/discover/paths.c +++ b/discover/paths.c @@ -131,7 +131,10 @@ static void load_process_to_local_file(struct load_task *task, task->result->status = rc ? LOAD_ERROR : LOAD_ASYNC; } else { rc = process_run_sync(task->process); - task->result->status = rc ? LOAD_ERROR : LOAD_OK; + if (rc || WEXITSTATUS(task->process->exit_status)) + task->result->status = LOAD_ERROR; + else + task->result->status = LOAD_OK; process_release(task->process); task->process = NULL; } |