gcc 3 problem on sigaction and system
Kun Wei
weikun@caltech.edu
Sat Jul 19 04:25:00 GMT 2003
> 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-help
mailing list