mirror of https://github.com/mkerrisk/man-pages
setns.2: EXAMPLE: use O_CLOEXEC when opening namespace file descriptor
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
7cb61821b9
commit
298743a573
|
@ -396,7 +396,11 @@ main(int argc, char *argv[])
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_RDONLY); /* Get file descriptor for namespace */
|
||||
/* Get file descriptor for namespace; the file descriptor is opened with
|
||||
O_CLOEXEC so as to ensure that it is not inherited by the program that
|
||||
is later executed. */
|
||||
|
||||
fd = open(argv[1], O_RDONLY | O_CLOEXEC);
|
||||
if (fd == \-1)
|
||||
errExit("open");
|
||||
|
||||
|
|
Loading…
Reference in New Issue