diff options
| author | Paul Spooren | 2020-07-17 08:19:31 +0000 |
|---|---|---|
| committer | Daniel Golle | 2020-11-09 10:54:29 +0000 |
| commit | fac98f1c54a16073e28ab11adf195f9917a30ef6 (patch) | |
| tree | 121cbb4d3ee66ee78e3b33ce782dd5f20ac81c19 | |
| parent | 91a0dc5161e25085a01edd66b1d8da19593dcc4a (diff) | |
| download | openwrt-fac98f1c54a16073e28ab11adf195f9917a30ef6.tar.gz | |
scripts: mkhash fix return code handling
If hashing a file fails mkhash shouldn't just silently fail. Now check
after each call of `hash_file()` the return and exit early in case of
errors. The return value which was previously ignored and would always
return 0.
Signed-off-by: Paul Spooren <mail@aparcar.org>
| -rw-r--r-- | scripts/mkhash.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/mkhash.c b/scripts/mkhash.c index e26ca3a350..ce156e979d 100644 --- a/scripts/mkhash.c +++ b/scripts/mkhash.c @@ -823,8 +823,11 @@ int main(int argc, char **argv) if (argc < 2) return hash_file(t, NULL, add_filename); - for (i = 0; i < argc - 1; i++) - hash_file(t, argv[1 + i], add_filename); + for (i = 0; i < argc - 1; i++) { + int ret = hash_file(t, argv[1 + i], add_filename); + if (ret) + return ret; + } return 0; } |