Jessica Clarke, le dim. 24 janv. 2021 00:59:23 +0000, a ecrit: > On 24 Jan 2021, at 00:41, Damien Zammit <dam...@zamaudio.com> wrote: > > (void)ioctl(f, TIOCFLUSH, (char *) 0); > > It seems only QNX ends up setting POSIX for some inexplicable reason. > Since Hurd defines TIOCFLUSH, it ends up calling this line. But > TIOCFLUSH takes an int * pointing at flags, so when converting the > ioctl into an RPC it'll dereference the null pointer and segfault. It > should either pass a pointer to an int with the right flags or just use > tcflush like a sane program. > > NB: Neither Linux nor FreeBSD define/implement TIOCFLUSH.
This interface seems awfully confused. Looking at occurrences in Debian I can see all cases: - passing the address of int x = FREAD (as apparently expected...) - passing the address of int x = 0 (as apparently correctly interpreted as FREAD|FWRITE) but also - passing the address of int x = 1 - passing a NULL address - not passing anything (!) I'm starting to think that perhaps we should as well just comment the #define TIOCFLUSH from the headers, since there are so many bogus callers of the interface. Samuel