summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-01-16 20:45:06 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2019-01-17 09:42:09 +0100
commit7d9ffc2d54d09c47794aea2f0f54e823e8f1edc9 (patch)
treef869c2c2b9f124ba0f1f23998300ea9c968671f6 /crypto
parent64e88dd12960c6d629f997c4ee552377f597db02 (diff)
downloadbarebox-7d9ffc2d54d09c47794aea2f0f54e823e8f1edc9.tar.gz
barebox-7d9ffc2d54d09c47794aea2f0f54e823e8f1edc9.tar.xz
crypto: digest: Return -errno if stat() fails
Strictly speaking, stat() doesn't return a detailed error code as its return value and it can and should be obtained via 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/digest.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/crypto/digest.c b/crypto/digest.c
index 230db26e84..2c4de2e4f1 100644
--- a/crypto/digest.c
+++ b/crypto/digest.c
@@ -317,12 +317,9 @@ int digest_file(struct digest *d, const char *filename,
const unsigned char *sig)
{
struct stat st;
- int ret;
-
- ret = stat(filename, &st);
- if (ret < 0)
- return ret;
+ if (stat(filename, &st))
+ return -errno;
return digest_file_window(d, filename, hash, sig, 0, st.st_size);
}