This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 3 problem on sigaction and system
- From: <tm_gccmail at mail dot kloo dot net>
- To: Kun Wei <weikun at caltech dot edu>
- Cc: gcc at gcc dot gnu dot org, gcc-help-help at gcc dot gnu dot org
- Date: Fri, 18 Jul 2003 16:42:06 -0700 (PDT)
- Subject: Re: gcc 3 problem on sigaction and system
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