Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/kern Pull up following revision(s) (requested by dhol...



details:   https://anonhg.NetBSD.org/src/rev/b1b2f51a8f06
branches:  netbsd-6
changeset: 773942:b1b2f51a8f06
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Mar 19 23:23:10 2012 +0000

description:
Pull up following revision(s) (requested by dholland in ticket #128):
        sys/kern/tty.c: revision 1.250
PR/41673: Stathis Kamperis: tcsetpgrp returns EINVAL, but should return EPERM.

diffstat:

 sys/kern/tty.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (52 lines):

diff -r 558687e16ce4 -r b1b2f51a8f06 sys/kern/tty.c
--- a/sys/kern/tty.c    Mon Mar 19 23:21:23 2012 +0000
+++ b/sys/kern/tty.c    Mon Mar 19 23:23:10 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.249 2011/10/21 02:08:09 christos Exp $       */
+/*     $NetBSD: tty.c,v 1.249.8.1 2012/03/19 23:23:10 riz Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.249 2011/10/21 02:08:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.249.8.1 2012/03/19 23:23:10 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1271,7 +1271,7 @@
                mutex_exit(proc_lock);
                break;
        case FIOSETOWN: {               /* set pgrp of tty */
-               pid_t pgid = *(int *)data;
+               pid_t pgid = *(pid_t *)data;
                struct pgrp *pgrp;
 
                mutex_enter(proc_lock); 
@@ -1308,18 +1308,18 @@
        }
        case TIOCSPGRP: {               /* set pgrp of tty */
                struct pgrp *pgrp;
+               pid_t pgid = *(pid_t *)data;
+
+               if (pgid == NO_PGID)
+                       return EINVAL;
 
                mutex_enter(proc_lock); 
                if (!isctty(p, tp)) {
                        mutex_exit(proc_lock);
                        return (ENOTTY);
                }
-               pgrp = pgrp_find(*(pid_t *)data);
-               if (pgrp == NULL) {
-                       mutex_exit(proc_lock);
-                       return (EINVAL);
-               }
-               if (pgrp->pg_session != p->p_session) {
+               pgrp = pgrp_find(pgid);
+               if (pgrp == NULL || pgrp->pg_session != p->p_session) {
                        mutex_exit(proc_lock);
                        return (EPERM);
                }



Home | Main Index | Thread Index | Old Index