aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-01-10 15:42:31 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2017-01-10 15:42:31 +0100
commitf4fd3b71100121ae065ccaa5b58bee684c87718e (patch)
tree65920f7241fab3202c9fee3cd913a1fc5c7b17ed
parent4a17e1047dc06977dd63efa984b0692ff54329ea (diff)
downloadmkinitfs-f4fd3b71100121ae065ccaa5b58bee684c87718e.tar.bz2
mkinitfs-f4fd3b71100121ae065ccaa5b58bee684c87718e.tar.xz
nlplug-findfs: make sure we dont leak fd when execute lvm
-rw-r--r--nlplug-findfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nlplug-findfs.c b/nlplug-findfs.c
index f283d17..0df0f4c 100644
--- a/nlplug-findfs.c
+++ b/nlplug-findfs.c
@@ -732,7 +732,7 @@ static void trigger_uevent_cb(struct recurse_opts *opts, void *data)
if (!recurse_push(opts, &oldlen, "uevent"))
return;
- fd = open(opts->path, O_WRONLY);
+ fd = open(opts->path, O_WRONLY | O_CLOEXEC);
if (fd >= 0) {
write(fd, "add", 3);
close(fd);
@@ -799,7 +799,7 @@ static void append_line(const char *outfile, const char *data)
{
int fd;
if (outfile == 0) return;
- fd = open(outfile, O_WRONLY | O_CREAT | O_APPEND);
+ fd = open(outfile, O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC);
if (fd == -1)
err(1, "%s", outfile);
write(fd, data, strlen(data));