Re: fork() Problem?

Richard B. Johnson (root@chaos.analogic.com)
Wed, 5 May 1999 08:19:04 -0400 (EDT)


On Tue, 4 May 1999, Yavuz Selim Komur wrote:

>
> Hi,
> this problem maybe a gcc problem.
>
>
> main() {
> int i=0, *status;
^^^^^^^^ Uninitialized pointer

> if(i = fork()) {
> printf("Main Program2 pid: %i\n", getpid());
> wait(status);
^^^^^^^___________ status written to wherever.

Just a coding bug. Probably should be:

int status;

wait(&status);

Then the child's return status gets written to 'status'.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.6 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/