tailf: fix open() return value check [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2015-08-05 11:55:56 +02:00
parent 2660801513
commit c6556f7ca8
1 changed files with 2 additions and 1 deletions

View File

@ -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;