Why do you think apache gets a segfault?

    The only thing is the the 'domainname' key is missing from
    the hash although it should display the content of
    __domainname (on non-bsd systems)

    I'm willing to fix it if someone comes up with a proper patch
    that also honors BSD. It's not very critical I think (until I
    miss the obvious).

    - Markus

On Sun, Mar 24, 2002 at 12:16:41PM +0100, Vergoz Michael (SYSDOOR) wrote : 
> 

> Date: Sun, 24 Mar 2002 12:03:42 +0100
> From: "Vergoz Michael (SYSDOOR)" <[EMAIL PROTECTED]>
> Subject: posix_uname another bug @^|[@#\@^#~@{[?
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020214
> To: php-qa <[EMAIL PROTECTED]>
> >From - Sun Mar 24 12:03:43 2002
> X-Mozilla-Status2: 00000000
> 
> 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 Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to