From 4cc32dec579afbc4aa48de62ee125f532bf3fc94 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 24 Aug 2018 12:14:07 +0300 Subject: [PATCH] Return error codes from elfdeps processFile() always returned errors for things like non-existent file and non-elf file etc but we've ignored it all. Reflect such errors with non-zero exit code as per common practise. --- tools/elfdeps.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/elfdeps.c b/tools/elfdeps.c index 74c268484e..6d9094874d 100644 --- a/tools/elfdeps.c +++ b/tools/elfdeps.c @@ -353,6 +353,7 @@ static int processFile(const char *fn, int dtype) int main(int argc, char *argv[]) { + int rc = 0; int provides = 0; int requires = 0; poptContext optCon; @@ -381,16 +382,18 @@ int main(int argc, char *argv[]) if (poptPeekArg(optCon)) { const char *fn; while ((fn = poptGetArg(optCon)) != NULL) { - (void) processFile(fn, requires); + if (processFile(fn, requires)) + rc = EXIT_FAILURE; } } else { char fn[BUFSIZ]; while (fgets(fn, sizeof(fn), stdin) != NULL) { fn[strlen(fn)-1] = '\0'; - (void) processFile(fn, requires); + if (processFile(fn, requires)) + rc = EXIT_FAILURE; } } poptFreeContext(optCon); - return 0; + return rc; }