summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak2019-05-16 13:46:03 +0200
committerKarel Zak2019-05-16 13:46:03 +0200
commite868cfb0a6c2b942029b95c85168f7da116d5c06 (patch)
tree652b18a624756678e1ae5f05100d9212bd7c82b7 /login-utils
parentMerge branch 'lscpu-output-fix' of https://github.com/kerolasa/util-linux (diff)
downloadkernel-qcow2-util-linux-e868cfb0a6c2b942029b95c85168f7da116d5c06.tar.gz
kernel-qcow2-util-linux-e868cfb0a6c2b942029b95c85168f7da116d5c06.tar.xz
kernel-qcow2-util-linux-e868cfb0a6c2b942029b95c85168f7da116d5c06.zip
utmpdump: check ftello() return value
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/utmpdump.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c
index f1a3607dc..defa230b9 100644
--- a/login-utils/utmpdump.c
+++ b/login-utils/utmpdump.c
@@ -169,6 +169,9 @@ static int follow_by_inotify(FILE *in, const char *filename, FILE *out)
size = ftello(in);
fclose(in);
+ if (size < 0)
+ err(EXIT_FAILURE, _("%s: cannot get file position"), filename);
+
wd = inotify_add_watch(fd, filename, EVENTS);
if (wd == -1)
err(EXIT_FAILURE, _("%s: cannot add inotify watch."), filename);