Bug #14924: The POSIX access(2) function is not available

From: Date: Tue, 08 Jan 2002 03:40:52 +0000
Subject: Bug #14924: The POSIX access(2) function is not available
Groups: php.dev 
Request: Send a blank email to php-dev+get-76227@lists.php.net to get a copy of this message
From:             danpat@au.adaptiveinterantional.com
Operating system: Linux 2.4.17, Debian unstable
PHP version:      4.1.0
PHP Bug Type:     POSIX related
Bug description:  The POSIX access(2) function is not available

Seeing as is_readable, is_writeable and is_executable all
work out the file permissions masks themselves, it might
be nice to have access to the posix function access(2) so that
file permissions in situations where mask comparision is
not sufficient (e.g. when using POSIX ACL's on the filesystem,
such as is available with SGI's XFS on Linux and Irix).

It should simply be a matter of (in ext/posix/posix.c

  #include <unistd.h>
  ....
  PHP_FE(posix_access, NULL)
  ....

  /* {{{ proto bool posix_access(string filename, int mode)
   check user's permissions for a file */
  PHP_FUNCTION(posix_access)
  {
    char *filename = NULL;
    int argc = ZEND_NUM_ARGS();
    int mode = 0;
    if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &filename, &mode) ==
FAILURE)
      return;

    if (access(filename, mode) != 0) {
      php_error(E_WARNING,"posix_access: error checking access for %s: %s",
filename, strerror(errno));
    } else {
      return 0;
    }
  }
 
As far as I can see, access() has always been a POSIX function.

-- 
Edit bug report at: http://bugs.php.net/?id=14924&edit=1



Thread (3 messages)

« previous php.dev (#76227) next »