]> granicus.if.org Git - php/commitdiff
- getlogin() / getgroups() are not necessarily available everywhere
authorfoobar <sniper@php.net>
Mon, 9 May 2005 12:15:53 +0000 (12:15 +0000)
committerfoobar <sniper@php.net>
Mon, 9 May 2005 12:15:53 +0000 (12:15 +0000)
ext/posix/config.m4
ext/posix/php_posix.h
ext/posix/posix.c

index fc3767e98b51cf7892c2f62bb5e4e1e9ec15d483..e687f73bf7e008b987f897cddce9757354faf21e 100644 (file)
@@ -9,5 +9,5 @@ if test "$PHP_POSIX" = "yes"; then
   AC_DEFINE(HAVE_POSIX, 1, [whether to include POSIX-like functions])
   PHP_NEW_EXTENSION(posix, posix.c, $ext_shared)
 
-  AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo getrlimit)
+  AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid getpgid ctermid mkfifo getrlimit getlogin getgroups)
 fi
index 10e70c1f5fd7eef76a8a6b79361ac820829cb7b2..eff5efcf3005f46fb9666588ebdcdf918a1261d3 100644 (file)
@@ -54,8 +54,12 @@ PHP_FUNCTION(posix_seteuid);
 #ifdef HAVE_SETEGID
 PHP_FUNCTION(posix_setegid);
 #endif
+#ifdef HAVE_GETGROUPS
 PHP_FUNCTION(posix_getgroups);
+#endif
+#ifdef HAVE_GETLOGIN
 PHP_FUNCTION(posix_getlogin);
+#endif
 
 /* POSIX.1, 4.3 */
 PHP_FUNCTION(posix_getpgrp);
index fa985726fa567bc98ebc3503f2609a1c199e72be..42c1164e917d1fe8c55f8f86c435e73ec6484a07 100644 (file)
@@ -70,8 +70,12 @@ function_entry posix_functions[] = {
 #ifdef HAVE_SETEGID
        PHP_FE(posix_setegid,   NULL)
 #endif
+#ifdef HAVE_GETGROUPS
        PHP_FE(posix_getgroups, NULL)
+#endif
+#ifdef HAVE_GETLOGIN
        PHP_FE(posix_getlogin,  NULL)
+#endif
 
        /* POSIX.1, 4.3 */
        PHP_FE(posix_getpgrp,   NULL)
@@ -299,6 +303,7 @@ PHP_FUNCTION(posix_setegid)
 
 /* {{{ proto array posix_getgroups(void)
    Get supplementary group id's (POSIX.1, 4.2.3) */
+#ifdef HAVE_GETGROUPS
 PHP_FUNCTION(posix_getgroups)
 {
        gid_t  gidlist[NGROUPS_MAX];
@@ -318,10 +323,12 @@ PHP_FUNCTION(posix_getgroups)
                add_next_index_long(return_value, gidlist[i]);
        }
 }
+#endif
 /* }}} */
 
 /* {{{ proto string posix_getlogin(void) 
    Get user name (POSIX.1, 4.2.4) */
+#ifdef HAVE_GETLOGIN
 PHP_FUNCTION(posix_getlogin)
 {
        char *p;
@@ -335,6 +342,7 @@ PHP_FUNCTION(posix_getlogin)
        
        RETURN_STRING(p, 1);
 }
+#endif
 /* }}} */
 
 /* {{{ proto int posix_getpgrp(void)