lvm2/clmvd-fix-decriptor-leak-on-restart.patch

29 lines
818 B
Diff

From 7b1315411f1de73801fd38f264ca507ae3807e53 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 6 Aug 2013 16:07:50 +0200
Subject: [PATCH] clmvd: fix decriptor leak on restart
Do not leave descriptor used for dup2() openned.
---
daemons/clvmd/clvmd.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index f05776f..eaa75ca 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -1085,6 +1085,10 @@ static void be_daemon(int timeout)
log_error("Error setting terminal FDs to /dev/null: %m");
exit(5);
}
+ if ((devnull > STDERR_FILENO) && close(devnull)) {
+ log_sys_error("close", "/dev/null");
+ exit(7);
+ }
if (chdir("/")) {
log_error("Error setting current directory to /: %m");
exit(6);
--
1.8.4.5