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@xxxxxxxxx>
---
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
>From cdab1ab2d2c94dd323c1b5fd274e48205afec8e8 Mon Sep 17 00:00:00 2001
From: Topi Miettinen <toiwoton@xxxxxxxxx>
Date: Mon, 23 Dec 2019 18:03:24 +0200
Subject: [PATCH] generator: fix file descriptor leak
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@xxxxxxxxx>
---
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
_______________________________________________
linux-lvm mailing list
linux-lvm@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/