![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Get both PID and exit status of a child process | DarioHendrix | Shell Programming and Scripting | 2 | 02-26-2009 06:30 PM |
| Exit from n th child shell | indra_saha | UNIX for Dummies Questions & Answers | 4 | 09-26-2008 06:48 AM |
| Getting exit status of child in trap handler | rimon | Shell Programming and Scripting | 4 | 06-17-2008 02:05 AM |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-10-2008 12:22 AM |
| gdb to child process | shriashishpatil | UNIX for Advanced & Expert Users | 4 | 12-12-2005 07:57 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Why does my child process not exit?
Im sure it has something to do with the wait() call, but everything ive tried either leaves me with a zombie or with the exec executing indefinitely. Code:
switch(pid = fork())
{
case -1:perror("fork failed");
exit(1);
case 0:
if(key == "cd")
{
execl("/bin/cd", "cd", data, (char *)0);
}
else{
execl("/bin/sh", key, data, (char *)0);
perror("exec failed");
exit(status);
}
default: waitpid (pid, &status, 0);
printf("Done: \n");
exit(0);
}
Last edited by vbe; 07-03-2009 at 09:51 AM.. Reason: added code tag |
|
||||
|
Quote:
---------- Post updated at 03:49 PM ---------- Previous update was at 11:52 AM ---------- alright I got it. thanks for the suggestion. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|