[PATCH] fix setpgid

Andries.Brouwer@cwi.nl
Mon, 20 Jan 2003 23:03:31 +0100 (MET)


In patch-2.5.37 a return code of setpgid(pid,pgid) was broken.
If pid is not the current process and is not a child of
the current process it should return ESRCH, but the 2.5.37
patch turned this into EINVAL. The below fixes this again.

Andries

--- /linux/2.5/linux-2.5.59/linux/kernel/sys.c Tue Dec 10 18:42:42 2002
+++ /linux/2.5/linux-2.5.59a/linux/kernel/sys.c Mon Jan 20 22:04:52 2003
@@ -916,6 +916,7 @@
p = find_task_by_pid(pid);
if (!p)
goto out;
+
err = -EINVAL;
if (!thread_group_leader(p))
goto out;
@@ -927,8 +928,12 @@
err = -EACCES;
if (p->did_exec)
goto out;
- } else if (p != current)
- goto out;
+ } else {
+ err = -ESRCH;
+ if (p != current)
+ goto out;
+ }
+
err = -EPERM;
if (p->leader)
goto out;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/