[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: telnet segfaults on Hurd
From: |
Alain Magloire |
Subject: |
Re: telnet segfaults on Hurd |
Date: |
Fri, 17 Aug 2001 11:08:49 -0400 (EDT) |
Bonjour
> Hi,
>
> telnet segfaults on Hurd because of that:
>
> TerminalFlushOutput()
> {
> #ifdef TIOCFLUSH
> (void) ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
> #else
> (void) ioctl(fileno(stdout), TCFLSH, (char *) 0);
> #endif
> }
>
> TIOCFLUSH expects an (int *) as third argument. The Hurd always requires
> the arguments, as they are pasted to and from a server RPC.
It seems to me, that the Hurd should do a quick sanity check for
the null argument.
> Can't we better use tcdrain(fileno(stdout)) here anyway?
Not exactly, you probably mean: tcflush () not tcdrain ().
tcflush is more or less equivalent to
int
tcflush (int fd, int arg)
{
/* Some checking of TCIFLUSH | TCOFLUSH | TCIOFLUSH was left out. */
return ioctl (fd, TIOCFLUSH, (void *) &arg);
}
This is the good way but the long way to go, since tcflush()
needs to be check(configure.in) with a proper replacement in ineutils/lib.
Telnet client/server is litter with such code. And frankly at this time I
lack the courage to clean this out.
A simple fix is
TerminalFlushOutput()
{
int out = 0;
#ifdef TIOCFLUSH
(void) ioctl(fileno(stdout), TIOCFLUSH, (char *) &out);
#else
(void) ioctl(fileno(stdout), TCFLSH, (char *) &out);
#endif
}
Give it a try.
--
alain
- telnet segfaults on Hurd, Marcus Brinkmann, 2001/08/17
- Re: telnet segfaults on Hurd,
Alain Magloire <=
- Message not available