]> granicus.if.org Git - php/commitdiff
MFH: - getlogin() / getgroups() are not necessarily available everywhere
authorfoobar <sniper@php.net>
Mon, 9 May 2005 12:16:19 +0000 (12:16 +0000)
committerfoobar <sniper@php.net>
Mon, 9 May 2005 12:16:19 +0000 (12:16 +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 f466dacb5594082a58c16a5da4be53d1bc659ef8..1f260c4e315502f4dae67724a1e75da504c136b8 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 f36f6d11f764a49ab97f7139a12e3e24c8cdec42..d17ed9fac4d8ba6e0931940aaf431aa926b04238 100644 (file)
@@ -69,8 +69,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)
@@ -363,6 +367,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];
@@ -389,10 +394,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;
@@ -408,6 +415,7 @@ PHP_FUNCTION(posix_getlogin)
        
        RETURN_STRING(p, 1);
 }
+#endif
 /* }}} */
 
 /* {{{ proto int posix_getpgrp(void)