Re: 2002-07-10 changes in subshell.c

Hi, Pavel!

>         * subshell.c: ioctl() doesn't set errno - don't use perror() to
>         report failures.  Use fprintf() instead, ignore errors from
>         TIOCSWINSZ.
> I've noticed this changelog entry and I'm curious if the change is
> actually good. In fact ioctl() should set errno approapriately. However
> there is a bug in Cygwin's implementation of ioctl() + TIOCSWINSZ -
> please read more about it here:

I understand there are two separate problems.  One problem is that
TIOCSWINSZ doesn't work on pty as it should.  Another problem is that it's
possible for ioctl() to return a non-zero value without errno becoming

The discussion seems to cover the pty problem only, and doesn't really
discuss setting of errno.

Under Linux, ioctl() returns -1 for any failure, and errno is set to the
negated result of the return code from the kernel (the kernel returns
negative values, and errno is positive).  In case of success, the original
errno is preserved.

My comment in Changelog is wrong in general, but it's true for Cygwin, or
so it seems.  Anyway, it's just not worth the trouble to bother users with
such petty failures, especially since they are hard to display (if we are
in the middle of screen resize).

If mc gets a better logging facility (right now only FTP is logged),
that's something we may want to log.

Pavel Roskin

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]