bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Fix setsid(0)


From: Samuel Thibault
Subject: Re: [RFC] Fix setsid(0)
Date: Tue, 17 Jan 2006 22:45:58 +0100
User-agent: Mutt/1.5.9i-nntp

Hi,

Thomas Bushnell BSG, le Tue 17 Jan 2006 11:41:15 -0800, a écrit :
> This patch seems like the right idea.
> 
> 1: You should remove the comment that CALLERP is ignored.
> 2: CALLERP may be null if the RPC is received on the wrong kind of
>    port (in which case EOPNOTSUPP should be returned).
> 
> Can you propose a revised patch?

Sure, here it is.

Regards,
Samuel

[hurd]/proc/Changelog
2006-01-17  Samuel Thibault  <samuel.thibault@ens-lyon.org>

        Fix getsid(0).

        * pgrp.c (S_proc_getsid): Use `callerp' argument instead of
        pid_find(pid) when pid == 0.

Index: proc/pgrp.c
===================================================================
RCS file: /cvsroot/hurd/hurd/proc/pgrp.c,v
retrieving revision 1.23
diff -u -p -r1.23 pgrp.c
--- hurd/proc/pgrp.c    8 May 2002 09:24:52 -0000       1.23
+++ hurd/proc/pgrp.c    17 Jan 2006 21:44:39 -0000
@@ -141,11 +141,20 @@ S_proc_getsid (struct proc *callerp,
             pid_t pid,
             pid_t *sid)
 {
-  struct proc *p = pid_find (pid);
-  if (!p)
-    return ESRCH;
+  struct proc *p;
 
-  /* No need to check CALLERP; we don't use it. */
+  if (pid == 0)
+    {
+      if (!callerp)
+       return EOPNOTSUPP;
+      p = callerp;
+    }
+  else
+    {
+      p = pid_find (pid);
+      if (!p)
+       return ESRCH;
+    }
 
   *sid = p->p_pgrp->pg_session->s_sid;
   return 0;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]