diff options
author | jilles <jilles@FreeBSD.org> | 2016-04-09 19:29:39 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2016-04-09 19:29:39 +0000 |
commit | f563d215af94d54bbdb4aca07a470f1f3a18de2a (patch) | |
tree | 454fdef4ce6f7d368dc69d38a8620230a6834602 /lib/libc/sys | |
parent | 0b7191c4edd67a9751c3d0192656853db85a97cd (diff) | |
download | FreeBSD-src-f563d215af94d54bbdb4aca07a470f1f3a18de2a.zip FreeBSD-src-f563d215af94d54bbdb4aca07a470f1f3a18de2a.tar.gz |
MFC r287753: setuid(2): Suggest O_CLOEXEC instead of fcntl(F_SETFD).
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/setuid.2 | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/libc/sys/setuid.2 b/lib/libc/sys/setuid.2 index 4c7d5ad..54d89bc 100644 --- a/lib/libc/sys/setuid.2 +++ b/lib/libc/sys/setuid.2 @@ -28,7 +28,7 @@ .\" @(#)setuid.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd September 13, 2015 .Dt SETUID 2 .Os .Sh NAME @@ -178,15 +178,10 @@ pseudocode(void) int fd; /* ... */ - fd = open("/path/to/sensitive/data", O_RDWR); + fd = open("/path/to/sensitive/data", O_RDWR | O_CLOEXEC); if (fd == -1) err(1, "open"); - /* - * Set close-on-exec flag; see fcntl(2) for more information. - */ - if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) - err(1, "fcntl(F_SETFD)"); /* ... */ execve(path, argv, environ); } |