From: Karel Zak Date: Wed, 5 Aug 2015 09:55:56 +0000 (+0200) Subject: tailf: fix open() return value check [coverity scan] X-Git-Tag: v2.27-rc2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6556f7ca8ed99aa1f213471af7848a699927618;p=thirdparty%2Futil-linux.git tailf: fix open() return value check [coverity scan] Signed-off-by: Karel Zak --- diff --git a/text-utils/tailf.c b/text-utils/tailf.c index d05987af7b..ea082c795e 100644 --- a/text-utils/tailf.c +++ b/text-utils/tailf.c @@ -62,7 +62,8 @@ static void tailf(const char *filename, size_t lines, struct stat *st) size_t i; char *data; - if (!(fd = open(filename, O_RDONLY))) + fd = open(filename, O_RDONLY); + if (fd < 0) err(EXIT_FAILURE, _("cannot open %s"), filename); data = mmap(0, st->st_size, PROT_READ, MAP_SHARED, fd, 0); i = (size_t) st->st_size - 1;