diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-19 13:43:22 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-20 16:02:18 -0500 |
commit | e8f3e7a707f9362d8c2b481304c0e435258de6aa (patch) | |
tree | c50cd39c2ba71166960e01252dc4aed6f78b8621 /src | |
parent | df8067ef6d341efe8f86c6b24c7fb27fc6056bc1 (diff) |
logind: check return value from lseek
In practice this doesn't matter much because the read that follows will
likely fail, but we'll get a better error message.
CID #1368233.
Diffstat (limited to 'src')
-rw-r--r-- | src/login/logind-seat.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index e4836fcaab..30dac7997b 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -379,7 +379,8 @@ int seat_read_active_vt(Seat *s) { if (!seat_has_vts(s)) return 0; - lseek(s->manager->console_active_fd, SEEK_SET, 0); + if (lseek(s->manager->console_active_fd, SEEK_SET, 0) < 0) + return log_error_errno(errno, "lseek on console_active_fd failed: %m"); k = read(s->manager->console_active_fd, t, sizeof(t)-1); if (k <= 0) { @@ -396,10 +397,8 @@ int seat_read_active_vt(Seat *s) { } r = safe_atou(t+3, &vtnr); - if (r < 0) { - log_error("Failed to parse VT number %s", t+3); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to parse VT number \"%s\": %m", t+3); if (!vtnr) { log_error("VT number invalid: %s", t+3); |