From: foobar Date: Mon, 9 May 2005 12:16:19 +0000 (+0000) Subject: MFH: - getlogin() / getgroups() are not necessarily available everywhere X-Git-Tag: php-4.4.0RC1~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e213ff37c3981eaf51d9c2ca8871ad3ecaf37911;p=php MFH: - getlogin() / getgroups() are not necessarily available everywhere --- diff --git a/ext/posix/config.m4 b/ext/posix/config.m4 index fc3767e98b..e687f73bf7 100644 --- a/ext/posix/config.m4 +++ b/ext/posix/config.m4 @@ -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 diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h index f466dacb55..1f260c4e31 100644 --- a/ext/posix/php_posix.h +++ b/ext/posix/php_posix.h @@ -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); diff --git a/ext/posix/posix.c b/ext/posix/posix.c index f36f6d11f7..d17ed9fac4 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -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)