[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/posix config.m4 posix.c

2008-09-20 Thread Arnaud Le Blanc
lbarnaudSat Sep 20 22:13:00 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/ext/posix  config.m4 posix.c 
  Log:
  MFH: Fixed #46059 (Compile failure under IRIX 6.5.30 building posix.c)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1228r2=1.2027.2.547.2.1229diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1228 php-src/NEWS:1.2027.2.547.2.1229
--- php-src/NEWS:1.2027.2.547.2.1228Tue Sep 16 23:37:35 2008
+++ php-src/NEWSSat Sep 20 22:12:59 2008
@@ -18,7 +18,9 @@
   (Scott)
 - Fixed a crash on invalid method in ReflectionParameter constructor.
   (Christian Seiler)
-- Fixed buf #46053 (SplFileObject::seek - Endless loop). (Arnaud)
+- Fixed bug #46059 (Compile failure under IRIX 6.5.30 building posix.c). 
+  (Arnaud)
+- Fixed bug #46053 (SplFileObject::seek - Endless loop). (Arnaud)
 - Fixed bug #46051 (SplFileInfo::openFile - memory overlap). (Arnaud)
 - Fixed bug #46047 (SimpleXML converts empty nodes into object with nested 
   array). (Rob)
http://cvs.php.net/viewvc.cgi/php-src/ext/posix/config.m4?r1=1.12.4.5r2=1.12.4.6diff_format=u
Index: php-src/ext/posix/config.m4
diff -u php-src/ext/posix/config.m4:1.12.4.5 
php-src/ext/posix/config.m4:1.12.4.6
--- php-src/ext/posix/config.m4:1.12.4.5Thu Mar  1 11:23:54 2007
+++ php-src/ext/posix/config.m4 Sat Sep 20 22:12:59 2008
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.12.4.5 2007/03/01 11:23:54 tony2001 Exp $
+dnl $Id: config.m4,v 1.12.4.6 2008/09/20 22:12:59 lbarnaud Exp $
 dnl
 
 PHP_ARG_ENABLE(posix,whether to enable POSIX-like functions,
@@ -31,4 +31,20 @@
   ], [
 AC_MSG_RESULT([no, cannot detect working ttyname_r() when cross compiling. 
posix_ttyname() will be thread-unsafe])
   ])
+
+  AC_CACHE_CHECK([for utsname.domainname], ac_cv_have_utsname_domainname, [
+AC_TRY_COMPILE([
+  #define _GNU_SOURCE
+  #include sys/utsname.h
+],[
+  return sizeof(((struct utsname *)0)-domainname);
+],[
+  ac_cv_have_utsname_domainname=yes
+],[
+  ac_cv_have_utsname_domainname=no
+])
+  ])
+  if test ac_cv_have_utsname_domainname=yes; then
+AC_DEFINE(HAVE_UTSNAME_DOMAINNAME, 1, [Wether struct utsname has 
domainname])
+  fi
 fi
http://cvs.php.net/viewvc.cgi/php-src/ext/posix/posix.c?r1=1.70.2.3.2.19r2=1.70.2.3.2.20diff_format=u
Index: php-src/ext/posix/posix.c
diff -u php-src/ext/posix/posix.c:1.70.2.3.2.19 
php-src/ext/posix/posix.c:1.70.2.3.2.20
--- php-src/ext/posix/posix.c:1.70.2.3.2.19 Wed Aug 20 20:04:52 2008
+++ php-src/ext/posix/posix.c   Sat Sep 20 22:12:59 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: posix.c,v 1.70.2.3.2.19 2008/08/20 20:04:52 rasmus Exp $ */
+/* $Id: posix.c,v 1.70.2.3.2.20 2008/09/20 22:12:59 lbarnaud Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -147,7 +147,7 @@
 static PHP_MINFO_FUNCTION(posix)
 {
php_info_print_table_start();
-   php_info_print_table_row(2, Revision, $Revision: 1.70.2.3.2.19 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.70.2.3.2.20 $);
php_info_print_table_end();
 }
 /* }}} */
@@ -467,7 +467,7 @@
add_assoc_string(return_value, release,  u.release,  1);
add_assoc_string(return_value, version,  u.version,  1);
add_assoc_string(return_value, machine,  u.machine,  1);
-#if defined(_GNU_SOURCE)  !defined(DARWIN)
+#if defined(_GNU_SOURCE)  !defined(DARWIN)  
defined(HAVE_UTSNAME_DOMAINNAME)
add_assoc_string(return_value, domainname, u.domainname, 1);
 #endif
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/posix config.m4 posix.c

2006-12-06 Thread Ilia Alshanetsky
iliaa   Thu Dec  7 01:41:19 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/posix  posix.c config.m4 
/php-srcNEWS 
  Log:
  Fixed bug #39754 (Some POSIX extension functions not thread safe).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/posix/posix.c?r1=1.70.2.3.2.7r2=1.70.2.3.2.8diff_format=u
Index: php-src/ext/posix/posix.c
diff -u php-src/ext/posix/posix.c:1.70.2.3.2.7 
php-src/ext/posix/posix.c:1.70.2.3.2.8
--- php-src/ext/posix/posix.c:1.70.2.3.2.7  Thu Nov 30 00:35:15 2006
+++ php-src/ext/posix/posix.c   Thu Dec  7 01:41:18 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: posix.c,v 1.70.2.3.2.7 2006/11/30 00:35:15 iliaa Exp $ */
+/* $Id: posix.c,v 1.70.2.3.2.8 2006/12/07 01:41:18 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -147,7 +147,7 @@
 static PHP_MINFO_FUNCTION(posix)
 {
php_info_print_table_start();
-   php_info_print_table_row(2, Revision, $Revision: 1.70.2.3.2.7 $);
+   php_info_print_table_row(2, Revision, $Revision: 1.70.2.3.2.8 $);
php_info_print_table_end();
 }
 /* }}} */
@@ -555,6 +555,9 @@
zval **z_fd;
char *p;
int fd;
+#if HAVE_TTYNAME_R
+   size_t buflen;
+#endif
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z, z_fd) == 
FAILURE) {
RETURN_FALSE;
@@ -570,12 +573,22 @@
convert_to_long_ex(z_fd);
fd = Z_LVAL_PP(z_fd);
}
+#if HAVE_TTYNAME_R
+   buflen = sysconf(_SC_TTY_NAME_MAX);
+   p = emalloc(buflen);
 
+   if (ttyname_r(fd, p, buflen)) {
+   POSIX_G(last_error) = errno;
+   efree(p);
+   RETURN_FALSE;
+   }
+   RETURN_STRING(p, 0);
+#else
if (NULL == (p = ttyname(fd))) {
POSIX_G(last_error) = errno;
RETURN_FALSE;
}
-   
+#endif 
RETURN_STRING(p, 1);
 }
 /* }}} */
@@ -809,22 +822,41 @@
char *name;
struct group *g;
int name_len;
+#if HAVE_GETGRNAM_R
+   struct group gbuf;
+   int buflen;
+   char *buf;
+#endif

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, name, 
name_len) == FAILURE) {
RETURN_FALSE;
}
 
+#if HAVE_GETGRNAM_R
+   buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+   buf = emalloc(buflen);
+   g = gbuf;
+
+   if (getgrnam_r(name, g, buf, buflen, g) || g == NULL) {
+   POSIX_G(last_error) = errno;
+   efree(buf);
+   RETURN_FALSE;
+   }
+#else
if (NULL == (g = getgrnam(name))) {
POSIX_G(last_error) = errno;
RETURN_FALSE;
}
-   
+#endif
array_init(return_value);
 
if (!php_posix_group_to_array(g, return_value)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to convert 
posix group to array);
-   RETURN_FALSE;
+   RETVAL_FALSE;
}
+#if HAVE_GETGRNAM_R
+   efree(buf);
+#endif
 }
 /* }}} */
 
@@ -852,7 +884,6 @@
efree(grbuf);
RETURN_FALSE;
}
-   efree(grbuf);
g = _g;
 #else
if (NULL == (g = getgrgid(gid))) {
@@ -864,8 +895,11 @@
 
if (!php_posix_group_to_array(g, return_value)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to convert 
posix group struct to array);
-   RETURN_FALSE;
+   RETVAL_FALSE;
}
+#ifdef HAVE_GETGRGID_R
+   efree(grbuf);
+#endif
 }
 /* }}} */
 
@@ -892,23 +926,41 @@
struct passwd *pw;
char *name;
int name_len;
-   
+#ifdef HAVE_GETPWNAM_R
+   struct passwd pwbuf;
+   int buflen;
+   char *buf;
+#endif
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, name, 
name_len) == FAILURE) {
RETURN_FALSE;
}
 
+#ifdef HAVE_GETPWNAM_R
+   buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+   buf = emalloc(buflen);
+   pw = pwbuf;
+
+   if (getpwnam_r(name, pw, buf, buflen, pw) || pw == NULL) {
+   efree(buf);
+   POSIX_G(last_error) = errno;
+   RETURN_FALSE;
+   }
+#else
if (NULL == (pw = getpwnam(name))) {
POSIX_G(last_error) = errno;
RETURN_FALSE;
}
-   
+#endif 
array_init(return_value);
 
if (!php_posix_passwd_to_array(pw, return_value)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, unable to convert 
posix passwd struct to array);
-   RETURN_FALSE;
+   RETVAL_FALSE;
}
-
+#ifdef HAVE_GETPWNAM_R
+   efree(buf);
+#endif
 }
 /* }}} */
 
@@ -936,7 +988,6 @@
efree(pwbuf);
RETURN_FALSE;
}
-   efree(pwbuf);
pw = _pw;
 #else
if (NULL == (pw = getpwuid(uid))) {
@@ -948,8 +999,11 @@
 
if