Re: error with system() command: Resource temporarily unavailable

From: Arti Potnis (artpot78_at_yahoo.com)
Date: 07/08/04


Date: 8 Jul 2004 00:46:11 -0700

Villy Kruse <vek@station02.ohout.pharmapartners.nl> wrote in message news:<slrncen9u9.7rf.vek@station02.ohout.pharmapartners.nl>...
> On 6 Jul 2004 23:01:07 -0700,
> Arti Potnis <artpot78@yahoo.com> wrote:
>
>
> >
> > I'm getting this problem in a number of other places too.For instance
> > there is a program which runs a
> > system("grep -i 'pattern' myfile")
> > If the pattern exists it returns the result but if it doesn't then it
> > returns errno=11.
> > No other program accesses the file being grepped.
> >
>
>
> And what does system() itself return?
>
> I strongly suspect that the value of errno was left over from a previous
> library function call. I don't expect the errno to be set at all if
> the command started by system() returns an error except when the fork()
> syscall inside the syscall() fails to create a new process. Once a new
> process is created it won't have much influence on the errno variable
> in the original process.
>
> Villy

-------------------------------------------------------------------
yes ,you are right. I initialized errno to 0 before calling the system
command. Now,after the system command, errno is set to 0 and system
command itself returns 256

-Arti
-------------------------------------------------------------------

-------------------------------------------------------------------