chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
10d975f
)
util: fix close() call on wrong variable
author
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Wed, 5 Oct 2011 20:31:41 +0000
(22:31 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Mon, 10 Oct 2011 20:30:57 +0000
(22:30 +0200)
Detected by "cppcheck" (actually it detected a file descriptor leak)
src/util.c
patch
|
blob
|
history
diff --git
a/src/util.c
b/src/util.c
index 7977ee46c57c2051fb25684da1ca757a19257597..e46606dabb39551e0b0b5b3df5a39ef311ee861b 100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-2307,8
+2307,10
@@
int chvt(int vt) {
0
};
- if (ioctl(fd, TIOCLINUX, tiocl) < 0)
- return -errno;
+ if (ioctl(fd, TIOCLINUX, tiocl) < 0) {
+ r = -errno;
+ goto fail;
+ }
vt = tiocl[0] <= 0 ? 1 : tiocl[0];
}
@@
-2316,7
+2318,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;
}