From: "Teresa Gámez" <t.gamez@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH] read_file_2: Fix return value
Date: Wed, 24 Sep 2014 08:49:51 +0200 [thread overview]
Message-ID: <1411541391-19948-1-git-send-email-t.gamez@phytec.de> (raw)
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>
---
lib/libfile.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/libfile.c b/lib/libfile.c
index c6fb6d7..c626e2f 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)
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2014-09-24 6:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 6:49 Teresa Gámez [this message]
2014-09-25 5:44 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411541391-19948-1-git-send-email-t.gamez@phytec.de \
--to=t.gamez@phytec.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox