Return EINVAL if kernel only flags are passed to the rfork syscall rather

than silently masking them.
This commit is contained in:
John Baldwin 2001-12-19 00:53:23 +00:00
parent 17c9446aa8
commit 885ccc61f2

View File

@ -160,9 +160,11 @@ rfork(td, uap)
int error;
struct proc *p2;
/* mask kernel only flags out of the user flags */
/* Don't allow kernel only flags. */
if ((uap->flags & RFKERNELONLY) != 0)
return (EINVAL);
mtx_lock(&Giant);
error = fork1(td, uap->flags & ~RFKERNELONLY, &p2);
error = fork1(td, uap->flags, &p2);
if (error == 0) {
td->td_retval[0] = p2 ? p2->p_pid : 0;
td->td_retval[1] = 0;