From 7f591246936a5a2b763851e3cb866be44a321d50 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 18 Jun 2002 16:15:51 +0000 Subject: Clarified documentation for os.access(). Patch contributed by Sean Reifschneider. Closes SF patch #570618. --- Doc/lib/libos.tex | 12 +++++++----- Modules/posixmodule.c | 6 +++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex index 02f44ce..f234e13 100644 --- a/Doc/lib/libos.tex +++ b/Doc/lib/libos.tex @@ -568,11 +568,13 @@ Availability: Windows. \subsection{Files and Directories \label{os-file-dir}} \begin{funcdesc}{access}{path, mode} -Check read/write/execute permissions for this process or existence of -file \var{path}. \var{mode} should be \constant{F_OK} to test the -existence of \var{path}, or it can be the inclusive OR of one or more -of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to test -permissions. Return \code{1} if access is allowed, \code{0} if not. +Use the real uid/gid to test for access to \var{path}. Note that most +operations will use the effective uid/gid, therefore this routine can +be used in a suid/sgid environment to test if the invoking user has the +specified access to \var{path}. \var{mode} should be \constant{F_OK} +to test the existence of \var{path}, or it can be the inclusive OR of +one or more of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to +test permissions. Return \code{1} if access is allowed, \code{0} if not. See the \UNIX{} man page \manpage{access}{2} for more information. Availability: \UNIX, Windows. \end{funcdesc} diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index f3d951a..838e2d7 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -736,7 +736,11 @@ posix_do_stat(PyObject *self, PyObject *args, char *format, PyDoc_STRVAR(posix_access__doc__, "access(path, mode) -> 1 if granted, 0 otherwise\n\ -Test for access to a file."); +Use the real uid/gid to test for access to a path. Note that most +operations will use the effective uid/gid, therefore this routine can +be used in a suid/sgid environment to test if the invoking user has the +specified access to the path. The mode argument can be F_OK to test +existance, or the inclusive-OR of R_OK, W_OK, and X_OK."); static PyObject * posix_access(PyObject *self, PyObject *args) -- cgit v0.12