gcc 3 problem on sigaction and system

tm_gccmail@mail.kloo.net tm_gccmail@mail.kloo.net
Sat Jul 19 11:09:00 GMT 2003


On Fri, 18 Jul 2003, Kun Wei wrote:

Please read:

http://gcc.gnu.org/bugs.html

to learn the proper procedure for reporting (possible) bugs.

Thanks.

Toshi

> Hi;
> I notice since gcc 3, the return value of system() doesn't work
> correctly. The following code will return 0 or -1 randomly, please help
> me how to solve this problem because I need to check if return value is
> -1 to make sure  system call is fine or not.
> 
> #include <signal.h>
> 
> main()
> {
>         struct sigaction v_sig;
> 
>         #if !defined(linux)
>                 v_sig.sa_flags =  SA_NOCLDWAIT;
>         #else
>                 v_sig.sa_handler = SIG_IGN;
>         #endif
> 
>         sigaction(SIGCHLD, &v_sig, 0);
> 
>         printf("return %d\n", system("ls -l > /dev/null"));
> 
>         return (0);
> }
> 
> Thanks a lot
> Kun



More information about the Gcc mailing list