* [linux-lvm] [PATCH] generator: fix file descriptor leak
@ 2019-12-23 16:08 Topi Miettinen
0 siblings, 0 replies; only message in thread
From: Topi Miettinen @ 2019-12-23 16:08 UTC (permalink / raw)
To: linux-lvm
[-- Attachment #1: Type: text/plain, Size: 852 bytes --]
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@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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-generator-fix-file-descriptor-leak.patch --]
[-- Type: text/x-diff; name="0001-generator-fix-file-descriptor-leak.patch", Size: 0 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-12-23 16:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-23 16:08 [linux-lvm] [PATCH] generator: fix file descriptor leak Topi Miettinen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.