Date: Sat, 17 Apr 2010 15:52: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: r206760 - head/lib/libc/gen Message-ID: <201004171552.o3HFqopa001518@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sat Apr 17 15:52:50 2010 New Revision: 206760 URL: http://svn.freebsd.org/changeset/base/206760 Log: getcwd(3): Clarify that EACCES may or may not be checked. POSIX permits but does not require checking access on the current and parent directories. Because various programs do not like it if getcwd(3) fails, it seems best to avoid checking access as much as possible. There are various reports in GNATS about this (search for getcwd). Our getcwd(3) implementation first queries the kernel for the pathname directly, which does not check any permissions but sometimes fails, and then falls back to reading all parent directories for the names. PR: standards/44425 MFC after: 2 weeks Modified: head/lib/libc/gen/getcwd.3 Modified: head/lib/libc/gen/getcwd.3 ============================================================================== --- head/lib/libc/gen/getcwd.3 Sat Apr 17 14:35:46 2010 (r206759) +++ head/lib/libc/gen/getcwd.3 Sat Apr 17 15:52:50 2010 (r206760) @@ -28,7 +28,7 @@ .\" @(#)getcwd.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd November 24, 1997 +.Dd April 17, 2010 .Dt GETCWD 3 .Os .Sh NAME @@ -108,8 +108,6 @@ The function will fail if: .Bl -tag -width Er -.It Bq Er EACCES -Read or search permission was denied for a component of the pathname. .It Bq Er EINVAL The .Fa size @@ -124,6 +122,16 @@ The argument is greater than zero but smaller than the length of the pathname plus 1. .El +.Pp +The +.Fn getcwd +function +may fail if: +.Bl -tag -width Er +.It Bq Er EACCES +Read or search permission was denied for a component of the pathname. +This is only checked in limited cases, depending on implementation details. +.El .Sh SEE ALSO .Xr chdir 2 , .Xr fchdir 2 ,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004171552.o3HFqopa001518>