]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd TIOCFLUSH: Cope BSD 4.1 semantic
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 1 Feb 2021 18:39:48 +0000 (19:39 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 1 Feb 2021 18:39:48 +0000 (19:39 +0100)
BSD 4.1 did not have an argument for TIOCFLUSH, BSD 4.2 added it. There
are still a lot of applications out there that pass a NULL argument to
TIOCFLUSH, so we should rather cope with it.

sysdeps/mach/hurd/ioctl.c

index 662e8ee9196409823ba45372e53e10355f87e134..0d5bc176d10d0954e070e010e8f5329447895d36 100644 (file)
@@ -113,6 +113,10 @@ __ioctl (int fd, unsigned long int request, ...)
          /* We don't want to advance ARG since it will be used to copy out
             too if IOC_OUT is also set.  */
          void *argptr = arg;
+         int zero = 0;
+
+         if (request == TIOCFLUSH && !arg)
+           arg = &zero;
 
          /* Pack an argument into the message buffer.  */
          void in (unsigned int count, enum __ioctl_datum type)