summaryrefslogtreecommitdiff
path: root/ext/posix
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2005-05-09 12:15:53 +0000
committerfoobar <sniper@php.net>2005-05-09 12:15:53 +0000
commit4b87d8360ec3e3efd1e3451879b890584563d55c (patch)
treea8e0459e7fb23717125523af6a85763f2e51f93f /ext/posix
parent30c554a0ac79c3baeec2741871b5696ea4834b61 (diff)
downloadphp-git-4b87d8360ec3e3efd1e3451879b890584563d55c.tar.gz
- getlogin() / getgroups() are not necessarily available everywhere
Diffstat (limited to 'ext/posix')
-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 10e70c1f5f..eff5efcf30 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 fa985726fa..42c1164e91 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)
@@ -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)