[Bugme-new] [Bug 33992] New: Applying inappropriate ioctl operation on socket should return ENOTTY

bugzilla-daemon at bugzilla.kernel.org bugzilla-daemon at bugzilla.kernel.org
Tue Apr 26 21:02:56 PDT 2011


https://bugzilla.kernel.org/show_bug.cgi?id=33992

           Summary: Applying inappropriate ioctl operation on socket
                    should return ENOTTY
           Product: Networking
           Version: 2.5
    Kernel Version: all
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
        AssignedTo: acme at ghostprotocols.net
        ReportedBy: lifongsun at gmail.com
        Regression: No


ioctl() calls against a socket with an inappropriate ioctl operation
are incorrectly returning EINVAL rather than ENOTTY:

  [ENOTTY]
      Inappropriate I/O control operation.

This bug causes that when the standard input/output/error of ncurses
are redirected to a socket, it fails to set a NOTTY flag hence sticks
on line-buffered mode,

/* ncurses-5.9/ncurses/tinfo/lib_ttyflags.c */
[...]
            for (;;) {
                if (SET_TTY(termp->Filedes, buf) != 0) {
                    if (errno == EINTR)
                        continue;
                    if ((errno == ENOTTY) && (SP_PARM != 0)) /* fail */
                        SP_PARM->_notty = TRUE;
                    result = ERR;
                }
                break;
            }
[...]

This bug is not limited to socket, it also occurs in a lot of, maybe some
hundred, other ioctl operations, while in the patch I only fixed about a
dozen of additional ones in pipe, fifo and character device drivers.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Bugme-new mailing list