Date: Sun, 13 Sep 2015 14:00:50 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287753 - head/lib/libc/sys Message-ID: <201509131400.t8DE0oVH081613@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun Sep 13 14:00:49 2015 New Revision: 287753 URL: https://svnweb.freebsd.org/changeset/base/287753 Log: setuid(2): Suggest O_CLOEXEC instead of fcntl(F_SETFD). Modified: head/lib/libc/sys/setuid.2 Modified: head/lib/libc/sys/setuid.2 ============================================================================== --- head/lib/libc/sys/setuid.2 Sun Sep 13 13:58:46 2015 (r287752) +++ head/lib/libc/sys/setuid.2 Sun Sep 13 14:00:49 2015 (r287753) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509131400.t8DE0oVH081613>