1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

clogd: fix descriptor leak when daemonzing

This commit is contained in:
Zdenek Kabelac 2013-08-06 16:08:31 +02:00
parent 7b1315411f
commit 003f08c164
2 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.100 - Version 2.02.100 -
================================ ================================
Fix clogd descriptor leak when daemonizing.
Fix clvmd descriptor leak on restart. Fix clvmd descriptor leak on restart.
Add pipe_open/close() to replace less secure popen() glibc call. Add pipe_open/close() to replace less secure popen() glibc call.
Fix metadata area offset/size overflow if it's >= 4g and while using lvmetad. Fix metadata area offset/size overflow if it's >= 4g and while using lvmetad.

View File

@ -202,6 +202,12 @@ static void daemonize(void)
(dup2(devnull, 2) < 0)) /* reopen stderr */ (dup2(devnull, 2) < 0)) /* reopen stderr */
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
if ((devnull > STDERR_FILENO) && close(devnull)) {
LOG_ERROR("Failed to close descriptor %d: %s",
devnull, strerror(errno));
exit(EXIT_FAILURE);
}
LOG_OPEN("cmirrord", LOG_PID, LOG_DAEMON); LOG_OPEN("cmirrord", LOG_PID, LOG_DAEMON);
(void) dm_prepare_selinux_context(CMIRRORD_PIDFILE, S_IFREG); (void) dm_prepare_selinux_context(CMIRRORD_PIDFILE, S_IFREG);