From 05930d60ecfbe583ae35dc3f3040f451026e896f Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Wed, 9 Aug 2017 11:19:48 -0700 Subject: [PATCH] Return a predictable return code from re-exec Instead of returning the direct error code from the system() call to re-exec swupd update, return a predictable 0 or 1. System was previously returning 255 (out of range) when failing to re-exec swupd. Signed-off-by: Matthew Johnson --- src/update.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/update.c b/src/update.c index eb8af292..aac70ef7 100644 --- a/src/update.c +++ b/src/update.c @@ -218,16 +218,20 @@ static int re_exec_update(bool versions_match) { if (!versions_match) { fprintf(stderr, "ERROR: Inconsistency between version files, exiting now.\n"); - return -1; + return 1; } if (!swupd_cmd) { fprintf(stderr, "ERROR: Unable to determine re-update command, exiting now.\n"); - return -1; + return 1; } /* Run the swupd_cmd saved from main */ - return system(swupd_cmd); + if (system(swupd_cmd) != 0) { + return 1; + } + + return 0; } int main_update()