Re: posix_uname another bug @^|[@#\@^#~@{[?

From: Date: Sun, 24 Mar 2002 11:19:03 +0000
Subject: Re: posix_uname another bug @^|[@#\@^#~@{[?
References: 1  Groups: php.qa 
Request: Send a blank email to php-qa+get-4675@lists.php.net to get a copy of this message
Michael, again, if you have patches or commentson the code, please write to php-dev@lists.php.net . Derick On Sun, 24 Mar 2002, Vergoz Michael (SYSDOOR) wrote: > refere include file : sys/utsname.h ! > You can see if the macro __USE_GNU is set the char returned are > 'domainname' else the char are '__domainname' #@\[@~\ > You know this function can do a apache segfault ?! > Becarful cuz domainename doesn't exist on freebsd ! > > there is the current (PHP-4.2.0RC1) code on : ext/posix/posix.c > > /* {{{ proto array posix_uname(void) > Get system name (POSIX.1, 4.4.1) */ > PHP_FUNCTION(posix_uname) > { > struct utsname u; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) > return; > > if (uname(&u) < 0) { > POSIX_G(last_error) = errno; > RETURN_FALSE; > } > > if (array_init(return_value) == FAILURE) { > // TODO: Should we issue a warning here so we don't have ambiguity > // with the above return value ? > RETURN_FALSE; > } > > add_assoc_string(return_value, "sysname", u.sysname, 1); > add_assoc_string(return_value, "nodename", u.nodename, 1); > 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); > #ifdef _GNU_SOURCE /* i'm okay */ > add_assoc_string(return_value, "domainname", u.domainname, 1); /* <- > {|^@#\|^[#\ */ > #endif > } > /* }}} */ > > /*--------------------------------------------------------Fixed > code--------------------------------------------------*/ > > /* {{{ proto array posix_uname(void) > Get system name (POSIX.1, 4.4.1) */ > PHP_FUNCTION(posix_uname) > { > struct utsname u; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) > return; > > if (uname(&u) < 0) { > POSIX_G(last_error) = errno; > RETURN_FALSE; > } > > if (array_init(return_value) == FAILURE) { > // TODO: Should we issue a warning here so we don't have ambiguity > // with the above return value ? > RETURN_FALSE; > } > > add_assoc_string(return_value, "sysname", u.sysname, 1); > add_assoc_string(return_value, "nodename", u.nodename, 1); > 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); > #ifdef _GNU_SOURCE > #ifdef __USE_GNU > add_assoc_string(return_value, "domainname", u.domainname, 1); > #else > add_assoc_string(return_value, "domainname", u.__domainname, 1); > #endif > #endif > } > /* }}} */ > > > -- > PHP Quality Assurance Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > ----------------------------------------------------------------------- PHP: Scripting the Web - derick@php.net All your branches are belong to me! SRM: Script Running Machine - www.vl-srm.net -----------------------------------------------------------------------

« previous php.qa (#4675) next »