linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* system() return different value under 2.4.23 and 2.6.0-test11
@ 2003-12-04  5:01 fengxj
  2003-12-04 10:21 ` Raj
  0 siblings, 1 reply; 2+ messages in thread
From: fengxj @ 2003-12-04  5:01 UTC (permalink / raw)
  To: linux-kernel


Hi, everyone

I just found a simple program:

-----------------------------
#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. 

I use Slackware 9.1 with GCC 3.2.3 and libc 2.3.2


Regards.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: system() return different value under 2.4.23 and 2.6.0-test11
  2003-12-04  5:01 system() return different value under 2.4.23 and 2.6.0-test11 fengxj
@ 2003-12-04 10:21 ` Raj
  0 siblings, 0 replies; 2+ messages in thread
From: Raj @ 2003-12-04 10:21 UTC (permalink / raw)
  To: fengxj; +Cc: linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-04 10:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-04  5:01 system() return different value under 2.4.23 and 2.6.0-test11 fengxj
2003-12-04 10:21 ` Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).