[Prev][Next][Index][Thread]

Re: fork & exec.




Hello Asaf,

 After returning from the fork(2) system call you should call the wait(2)
system call, it will set the status bit mask to the exit status from the
tar comman, in your case value 3.
try the command

man 2 wait

good luck

Erez


On Tue, 5 Nov 1996, Asaf Sabag wrote:

> Amos, guys.
>  
> Maybe I did not make my self clear, 
> 
> When I do exec for /bin/tar the tar command is found and exec execute the tar.
> 
> For example:
> ------------
> 
> if (pid = fork() == 0) {
>  execid = execl("/bin/tar", "tar", "cvf", "/dev/fdo", 0)
>  perror("exec failed");
> }
> printf("exec passed\n");
> 
> the exec execute the tar and the exec passes OK.
> No error is printed.
> the massage : "exec passed" comes.
> 
> The problem is that if there is no disk in the drive or if there is no tar 
> file in it then the tar failes!
> 
> This leads to no error from exec! beacuse exec passed.
> and the massage "exec passed" comes, 
> 
> If I use the system command and tar failes I get an error masaage from tar.
> 
> For example:
> ------------
> 
> if (i = system("/bin/tar xvf /dev/fd0 > /tmp/TarList.txt") == 0)
>   XtManageChild(SysToolOBJ.DialogGoodExpand_ExpandDevice);
> else
>  XtManageChild(SysToolOBJ.ErrorMsgExpandFailed_ExpandDevice);
> 
> 
> I want to execute the same command with exec not system.
> But I don't get the error massage from tar within exec.
> 
> HOW can I make it work with exec???
> 
> BTW. I understand that there are no jumpers on the social life meetings???
> 
> Thanks,
> Asaf.
> 
> 
> --------------------------------------------------------
> Name   : Asaf Sabag NetManage - SQA Haifa
> E-mail : Asaf Sabag <asaf@netmanage.co.il>
> Date   : 11/05/96
> Time   : 09:55:54
> 
> This message was sent by Z-Mail Pro - from NetManage
> NetManage - delivers Standards Based IntraNet Solutions
> --------------------------------------------------------
> 
> 
> 


Follow-Ups: References: