summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortanimura <tanimura@FreeBSD.org>2002-01-19 06:34:58 +0000
committertanimura <tanimura@FreeBSD.org>2002-01-19 06:34:58 +0000
commit37250d53cb8a214f987b9f9e22f5ac8b7a8fa3d9 (patch)
tree356c7aa2769eb2daeb1870c478492edb52fae117
parent86e7a84bd8940f1417ed98be8b5fa5d649cb5138 (diff)
downloadFreeBSD-src-37250d53cb8a214f987b9f9e22f5ac8b7a8fa3d9.zip
FreeBSD-src-37250d53cb8a214f987b9f9e22f5ac8b7a8fa3d9.tar.gz
Lock the caller process if the pid passed to getsid() or getpgid()
equals to zero.
-rw-r--r--sys/compat/svr4/svr4_misc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 0feebe3..4771d90 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -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;
OpenPOWER on IntegriCloud