bug-hurd
[Top][All Lists]
Advanced

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

[RFC] Fix setsid(0)


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

Hi,

Currently, setsid(0) always return 1, while it should return the sid of
the calling process.  Here is a proposed patch:

[hurd]/proc/Changelog
2006-01-17  Samuel Thibault  <address@hidden>

        Fix setsid(0).

        * pgrp.c (S_proc_getsid): When pid == 0, use `callerp' argument
        instead of pid_find(pid).

Index: 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 02:59:59 -0000
@@ -141,7 +141,11 @@ S_proc_getsid (struct proc *callerp,
             pid_t pid,
             pid_t *sid)
 {
-  struct proc *p = pid_find (pid);
+  struct proc *p;
+  if (pid == 0)
+    p = callerp;
+  else
+    p = pid_find (pid);
   if (!p)
     return ESRCH;
 




reply via email to

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