about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/ioctl.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2021-02-01 19:39:48 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-02-01 19:39:48 +0100
commit36231bee7ab36d59dd121ea85b91411ae86945f3 (patch)
tree681ff9b1814deab75e5878f58d682e33d8833e4b /sysdeps/mach/hurd/ioctl.c
parentd5c8f98c5e6de207790d3e9edadf5bda4aa2521f (diff)
downloadglibc-36231bee7ab36d59dd121ea85b91411ae86945f3.tar.gz
glibc-36231bee7ab36d59dd121ea85b91411ae86945f3.tar.xz
glibc-36231bee7ab36d59dd121ea85b91411ae86945f3.zip
hurd TIOCFLUSH: Cope BSD 4.1 semantic
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.
Diffstat (limited to 'sysdeps/mach/hurd/ioctl.c')
-rw-r--r--sysdeps/mach/hurd/ioctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 662e8ee919..0d5bc176d1 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -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)