Re: vfork() from userland

Zack Weinberg (zack@rabi.columbia.edu)
Mon, 01 Feb 1999 16:30:26 -0500


Your program is buggy. If execlp() fails, you must call _exit()
immediately; otherwise main will return twice and the stack will be
trashed.

I am not certain whether calling fprintf() or execlp() in the child is
safe. I would avoid everything but system calls - write(), execve(),
etc.

It is also possible that the default wrapper used by syscall() doesn't
work correctly with vfork. If this were the case, however, your first
program should have blown up too.

zw

-
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/