[linux-lvm] [PATCH] generator: fix file descriptor leak
Topi Miettinen
toiwoton at gmail.com
Mon Dec 23 16:08:45 UTC 2019
Set close-on-exec flag for kmsg file descriptor, so that _error() can
be used in case of execve() failure.
Signed-off-by: Topi Miettinen <toiwoton at gmail.com>
---
scripts/lvm2_activation_generator_systemd_red_hat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c
b/scripts/lvm2_activation_generator_systemd_red_hat.c
index 0f4ac8da2..e137aaf89 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -23,7 +23,7 @@ static int _kmsg_fd;
static void _log_init(void)
{
// failing is harmless
- _kmsg_fd = open(KMSG_DEV_PATH, O_WRONLY | O_NOCTTY);
+ _kmsg_fd = open(KMSG_DEV_PATH, O_WRONLY | O_NOCTTY | O_CLOEXEC);
}
static void _log_exit(void)
--
2.24.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-generator-fix-file-descriptor-leak.patch
Type: text/x-diff
Size: 1010 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20191223/cc340356/attachment.bin>
More information about the linux-lvm
mailing list