1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Lock the caller process if the pid passed to getsid() or getpgid()

equals to zero.
This commit is contained in:
Seigo Tanimura 2002-01-19 06:34:58 +00:00
parent c0cbe6a9b8
commit af46379bcb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=89545

View File

@ -1021,8 +1021,9 @@ svr4_sys_pgrpsys(td, uap)
return 0;
case 2: /* getsid(pid) */
if (SCARG(uap, pid) != 0 &&
(p = svr4_pfind(SCARG(uap, pid))) == NULL)
if (SCARG(uap, pid) == 0)
PROC_LOCK(p);
else if ((p = svr4_pfind(SCARG(uap, pid))) == NULL)
return ESRCH;
/*
* This has already been initialized to the pid of
@ -1037,8 +1038,9 @@ svr4_sys_pgrpsys(td, uap)
case 4: /* getpgid(pid) */
if (SCARG(uap, pid) != 0 &&
(p = svr4_pfind(SCARG(uap, pid))) == NULL)
if (SCARG(uap, pid) == 0)
PROC_LOCK(p);
else if ((p = svr4_pfind(SCARG(uap, pid))) == NULL)
return ESRCH;
*retval = (int) p->p_pgrp->pg_id;