public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Florian Westphal <fw@strlen.de>
Cc: Alan Cox <alan@linux.intel.com>,
	linux-kernel@vger.kernel.org, gaowanlong@cn.fujitsu.com,
	gregkh@linuxfoundation.org, frank@lichtenheld.de
Subject: Re: regression, bisected: openpty fails from 3.7 onwards without devpts
Date: Fri, 11 Jan 2013 12:11:34 +0100	[thread overview]
Message-ID: <50EFF366.2000303@suse.cz> (raw)
In-Reply-To: <50EF45DF.4010905@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

On 01/10/2013 11:51 PM, Jiri Slaby wrote:
> On 01/10/2013 11:45 PM, Alan Cox wrote:
>> So we should just fix TIOCGPTN on a pty with no suitable name answer to
>> return -EINVAL
> 
> Yes, I agree as I'm expressed in my second mail. Sorry for the confusion.

Does the attached patch help?

-- 
js
suse labs

[-- Attachment #2: 0001-pty-return-EINVAL-for-TIOCGPTN-for-BSD-ptys.patch --]
[-- Type: text/x-patch, Size: 1307 bytes --]

>From e7f1242ca1d8d6a17c87a85091cc977d2040ef15 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Fri, 11 Jan 2013 12:06:27 +0100
Subject: [PATCH] pty: return EINVAL for TIOCGPTN for BSD ptys

Commit bbb63c514a3464342967237a51a21ea8f61ab951 (drivers:tty:fix up
ENOIOCTLCMD error handling) changed the default return value from tty
ioctl to be ENOTTY and not EINVAL. This is appropriate.

But in case of TIOCGPTN for the old BSD ptys glibc started failing
because it expects EINVAL to be returned. Only then it continues to
obtain the pts name the other way around.

So fix this case by explicit return of EINVAL in this case.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: Florian Westphal <fw@strlen.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/tty/pty.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index d04c39d..d2fd6f0 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -441,6 +441,8 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
 		return pty_get_pktmode(tty, (int __user *)arg);
 	case TIOCSIG:    /* Send signal to other side of pty */
 		return pty_signal(tty, (int) arg);
+	case TIOCGPTN: /* TTY returns ENOTTY, but glibc expects EINVAL here */
+		return -EINVAL;
 	}
 	return -ENOIOCTLCMD;
 }
-- 
1.8.1


  reply	other threads:[~2013-01-11 11:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10 14:46 regression, bisected: openpty fails from 3.7 onwards without devpts Florian Westphal
2013-01-10 15:50 ` Alan Cox
2013-01-10 16:29   ` Florian Westphal
2013-01-10 17:23     ` Jiri Slaby
2013-01-10 20:13       ` Jiri Slaby
2013-01-10 22:45       ` Alan Cox
2013-01-10 22:51         ` Jiri Slaby
2013-01-11 11:11           ` Jiri Slaby [this message]
2013-01-11 12:41             ` Florian Westphal
2013-01-11 12:44               ` Jiri Slaby
2013-01-11 13:18                 ` Alan Cox
2013-01-17 16:29                   ` Greg KH
2013-01-17 16:34                     ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50EFF366.2000303@suse.cz \
    --to=jslaby@suse.cz \
    --cc=alan@linux.intel.com \
    --cc=frank@lichtenheld.de \
    --cc=fw@strlen.de \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox