summaryrefslogtreecommitdiffstats
path: root/lib/libfile.c
diff options
context:
space:
mode:
authorTeresa Gámez <t.gamez@phytec.de>2014-09-24 08:49:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-09-25 07:44:12 +0200
commit9d50b3484548459f795e342c8c67e8584a071449 (patch)
treef482eb1825a4c451555307820ad9ebd9993302c1 /lib/libfile.c
parentea569b0a7a9de2cf9110928dfe97e63240f461b5 (diff)
downloadbarebox-9d50b3484548459f795e342c8c67e8584a071449.tar.gz
barebox-9d50b3484548459f795e342c8c67e8584a071449.tar.xz
read_file_2: Fix return value
Set return value correct in error case. This prevents barebox from crashing in some conditions. Signed-off-by: Teresa Gámez <t.gamez@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib/libfile.c')
-rw-r--r--lib/libfile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libfile.c b/lib/libfile.c
index c6fb6d7157..c626e2f4a0 100644
--- a/lib/libfile.c
+++ b/lib/libfile.c
@@ -163,8 +163,10 @@ again:
buf = xzalloc(read_size + 1);
fd = open(filename, O_RDONLY);
- if (fd < 0)
+ if (fd < 0) {
+ ret = fd;
goto err_out;
+ }
ret = read_full(fd, buf, read_size);
if (ret < 0)