From owner-svn-src-head@FreeBSD.ORG Mon Sep 12 10:07:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFA8C1065673; Mon, 12 Sep 2011 10:07:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F4728FC0C; Mon, 12 Sep 2011 10:07:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8CA7LIY020653; Mon, 12 Sep 2011 10:07:21 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8CA7Lp6020651; Mon, 12 Sep 2011 10:07:21 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201109121007.p8CA7Lp6020651@svn.freebsd.org> From: Ed Schouten Date: Mon, 12 Sep 2011 10:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225506 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2011 10:07:21 -0000 Author: ed Date: Mon Sep 12 10:07:21 2011 New Revision: 225506 URL: http://svn.freebsd.org/changeset/base/225506 Log: Fix error return codes for ioctls on init/lock state devices. In revision 223722 we introduced support for driver ioctls on init/lock state devices. Unfortunately the call to ttydevsw_cioctl() clobbers the value of the error variable, meaning that in many cases ioctl() will now return ENOTTY, even though the ioctl() was processed properly. Reported by: Boris Samorodov Patch by: jilles@ Approved by: re@ (kib@) Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Mon Sep 12 08:38:21 2011 (r225505) +++ head/sys/kern/tty.c Mon Sep 12 10:07:21 2011 (r225506) @@ -766,7 +766,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd struct thread *td) { struct tty *tp = dev->si_drv1; - int error = 0; + int error; tty_lock(tp); if (tty_gone(tp)) { @@ -777,6 +777,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd error = ttydevsw_cioctl(tp, dev2unit(dev), cmd, data, td); if (error != ENOIOCTL) goto done; + error = 0; switch (cmd) { case TIOCGETA: