[Prev][Next][Index][Thread]
Re: fork & exec.
On Mon, 4 Nov 1996, Asaf Sabag wrote:
> How can I know if the command in the exec function was Ok?
>
>
> I want to backup a file by tar to /dev/fd0 by exec,
> If there is no disk in the drive I get no error from the exec because the exec passed OK,
> but on the xterm I get cannot open /dev/fd0 : no such device or address, which means that tar
> failed.
>
> The exec return -1 on error, but there is no error because the tar was found, but the tar
> failed.
>
> How can I know that the tar failed?
>
Use wait() or waitpid() to obtain the exit status. Generally,
a status of 0 means that things suceeded, while a status of
non-zero means there were problems.
--randy
Randy Wright randy@ramat-negev.org.il
System Administrator - Ramat-Negev FreeNet
http://www.ramat-negev.org.il/
07-6572671 voice-telephone
...think what consequences this might very well lead to...
a return to the old "priesthood" of those who really know how...
...relative to everyone else relegated to the realm of restricted GUIs...
[ from alt.cyberpubk.tech : shearer@njcc.com ]
References: