]> granicus.if.org Git - php/commitdiff
fix posix_getsid() & posix_getpgid()
authorAntony Dovgal <tony2001@php.net>
Fri, 28 Jan 2005 00:26:07 +0000 (00:26 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 28 Jan 2005 00:26:07 +0000 (00:26 +0000)
/* looks like copy&paste error first introduced in PHP 3.0.10 (!) */

NEWS
ext/posix/posix.c

diff --git a/NEWS b/NEWS
index cb91c84d61da8e0769790a2ad166debf3f72dd52..4706de3fdf6948788b34cb4346fce0783503039e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ PHP                                                                        NEWS
 - Fixed a bug in mysqli_stmt_execute() (type conversion with NULL values). (Georg)
 - Fixed segfault in mysqli_fetch_field_direct() when invalid field offset 
   is passed. (Tony)
+- Fixed posix_getsid() & posix_getpgid() to return sid & pgid instead 
+  of true. (Tony)
 - Fixed bug #31710 (Wrong return values for mysqli_autocommit/commit/rollback).
   (Georg)
 - Fixed bug #31705 (parse_url() does not recognize http://foo.com#bar). (Ilia)
index 107c38d26abfbd4dac63bde2edc21ea856ac4c35..a7d2fd96381830fa227159757e7185adb2579060 100644 (file)
@@ -371,7 +371,16 @@ PHP_FUNCTION(posix_setpgid)
 #ifdef HAVE_GETPGID
 PHP_FUNCTION(posix_getpgid)
 {
-       PHP_POSIX_SINGLE_ARG_FUNC(getpgid);
+       long val;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
+               return;
+       }
+       
+       if ((val = getpgid(val)) < 0) {
+               POSIX_G(last_error) = errno;
+               RETURN_FALSE;
+       }
+       RETURN_LONG(val);
 }
 #endif
 /* }}} */
@@ -381,7 +390,16 @@ PHP_FUNCTION(posix_getpgid)
 #ifdef HAVE_GETSID
 PHP_FUNCTION(posix_getsid)
 {
-       PHP_POSIX_SINGLE_ARG_FUNC(getsid);
+       long val;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
+               return;
+       }
+       
+       if ((val = getsid(val)) < 0) {
+               POSIX_G(last_error) = errno;
+               RETURN_FALSE;
+       }
+       RETURN_LONG(val);
 }
 #endif
 /* }}} */