RE: [ILUG] Programming problem

From: Kenn Humborg (kenn at domain bluetree.ie)
Date: Mon 24 Jul 2000 - 15:08:34 IST


> why did you have the parent exec the process? it would be best
> to have the
> child do it. like so:
>
> pid = fork();
> if (pid > 0) {
> /* child exec's the program */
> return execv(myprogram,argv);
...

Bzzt! Wrong. fork() return 0 in the child and non-zero
in the parent. So that (pid > 0) should be (pid == 0).

Later,
Kenn



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:58 GMT