mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-09 19:29:15 +00:00
lxc_init: add missing O_CLOEXEC
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
ed58616410
commit
591f6f44a7
@ -87,7 +87,8 @@ static void prevent_forking(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
while (getline(&line, &len, f) != -1) {
|
while (getline(&line, &len, f) != -1) {
|
||||||
int fd, ret;
|
__do_close int fd = -EBADF;
|
||||||
|
int ret;
|
||||||
char *p, *p2;
|
char *p, *p2;
|
||||||
|
|
||||||
p = strchr(line, ':');
|
p = strchr(line, ':');
|
||||||
@ -118,7 +119,7 @@ static void prevent_forking(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(path, O_WRONLY);
|
fd = open(path, O_WRONLY | O_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (my_args.quiet)
|
if (my_args.quiet)
|
||||||
fprintf(stderr, "Failed to open \"%s\"\n", path);
|
fprintf(stderr, "Failed to open \"%s\"\n", path);
|
||||||
@ -129,7 +130,6 @@ static void prevent_forking(void)
|
|||||||
if (ret != 1 && !my_args.quiet)
|
if (ret != 1 && !my_args.quiet)
|
||||||
fprintf(stderr, "Failed to write to \"%s\"\n", path);
|
fprintf(stderr, "Failed to write to \"%s\"\n", path);
|
||||||
|
|
||||||
close(fd);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user