Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Aug 2019 15:51:17 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 239604] FIONREAD ioctl returns the wrong result on a master pty after the slave has been closed
Message-ID:  <bug-239604-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239604

            Bug ID: 239604
           Summary: FIONREAD ioctl returns the wrong result on a master
                    pty after the slave has been closed
           Product: Base System
           Version: 11.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: martin@lispworks.com
 Attachment #206224 text/plain
         mime type:

Created attachment 206224
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=206224&action=edit
Example to reproduce the bug

Compile the attached example with:

cc -lutil pty-fionread.c

When it is run, I would expect it to print:

bytes1 = 0
bytes2 = 0

but in FreeBSD it prints:

bytes1 = 0
bytes2 = 1

It looks like the FIOREAD ioctl always returns 1 after the slave side of the
pty has been closed, regardless of whether any data is available.  This
contradicts the man page and also differs from Linux (and Solaris and AIX,
which have very different code to open the pty).

-- 
You are receiving this mail because:
You are the assignee for the bug.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-239604-227>