summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2005-05-09 12:16:11 +0000
committerfoobar <sniper@php.net>2005-05-09 12:16:11 +0000
commit9ae244bca83144ba802d2832088fc509b0772877 (patch)
tree12c0ab6ec0756e1b6cadbfdfa98df23406aa7a08
parent5493a5af6b0f86c8bb6677960bb6df7a965c2a87 (diff)
downloadphp-git-9ae244bca83144ba802d2832088fc509b0772877.tar.gz
MFH: - getlogin() / getgroups() are not necessarily available everywhere
-rw-r--r--ext/posix/config.m42
-rw-r--r--ext/posix/php_posix.h4
-rw-r--r--ext/posix/posix.c8
3 files changed, 13 insertions, 1 deletions
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 1970c2dab9..4defff806e 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 ce5aeb6b28..3d6512d468 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -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)
@@ -293,6 +297,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];
@@ -312,10 +317,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;
@@ -329,6 +336,7 @@ PHP_FUNCTION(posix_getlogin)
RETURN_STRING(p, 1);
}
+#endif
/* }}} */
/* {{{ proto int posix_getpgrp(void)