[systemd-commits] src/shared
Thomas H.P. Andersen
phomes at kemper.freedesktop.org
Wed Oct 8 15:20:13 PDT 2014
src/shared/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 6f53e671aa7539cab02c9f739d84d28a343ca5bc
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Wed Oct 8 23:57:32 2014 +0200
util: avoid double close of fd
We could end with a double close if we close the fd loop and flush_fd
fails. That would make us goto fail and there we close the fd once
again. This patch sets the fd to the return value for safe_close: -1
A fd with negative value will be ignored by the next call to
safe_close.
CID#996223
diff --git a/src/shared/util.c b/src/shared/util.c
index bbd9bd1..5f6249e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2074,7 +2074,7 @@ int acquire_terminal(
* ended our handle will be dead. It's important that
* we do this after sleeping, so that we don't enter
* an endless loop. */
- safe_close(fd);
+ fd = safe_close(fd);
}
safe_close(notify);
More information about the systemd-commits
mailing list