lkml.org 
[lkml]   [2003]   [Dec]   [4]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 04 Dec 2003 15:51:09 +0530
FromRaj <>
SubjectRe: system() return different value under 2.4.23 and 2.6.0-test11
fengxj wrote:

>-----------------------------
>#include <stdio.h>
>#include <stdlib.h>
>#include <signal.h>
>
>int main(void)
>{
>        int ret;
>
>        signal(SIGCHLD, SIG_IGN);
>
>        ret = system("/bin/date 1>/dev/null");
>        printf("%d\n", ret);
>
>        return 0;
>}
>----------------------------
>
>runs under 2.4.23 with ret = 0,
>but under 2.6.0-test11, ret = -1.
>
>Why?
>
>And when i remove 
>    signal(...)
>it returns the same value 0. 
> 
>

It's happening because of the return values of wait4(). wait4() is
returning -1 in test11 whene SIGCHLD is SIG_IGN'ed.
/Raj

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:59    [from the cache]
©2003-2008