From: Topi Miettinen <toiwoton@gmail.com>
To: linux-lvm@redhat.com
Subject: [linux-lvm] [PATCH] generator: fix file descriptor leak
Date: Mon, 23 Dec 2019 18:08:45 +0200 [thread overview]
Message-ID: <780c005d-fb6f-c3fb-c700-e7d4f136ad48@gmail.com> (raw)
[-- 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 --]
reply other threads:[~2019-12-23 16:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=780c005d-fb6f-c3fb-c700-e7d4f136ad48@gmail.com \
--to=toiwoton@gmail.com \
--cc=linux-lvm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.