Detected by "cppcheck" (actually it detected a file descriptor leak)
Please CC: comments. Signed-off-by: Thomas Jarosch <thomas.jaro...@intra2net.com> --- src/util.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index 7977ee4..ae9d9bd 100644 --- a/src/util.c +++ b/src/util.c @@ -2308,7 +2308,10 @@ int chvt(int vt) { }; if (ioctl(fd, TIOCLINUX, tiocl) < 0) - return -errno; + { + r = -errno; + goto fail; + } vt = tiocl[0] <= 0 ? 1 : tiocl[0]; } @@ -2316,7 +2319,8 @@ int chvt(int vt) { if (ioctl(fd, VT_ACTIVATE, vt) < 0) r = -errno; - close_nointr_nofail(r); +fail: + close_nointr_nofail(fd); return r; } -- 1.7.4.4 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel