On Sat, Jul 13, 2002 at 09:48:05PM +0200, Rein Klazes wrote: > On Fri, 12 Jul 2002 23:22:13 +0200, you wrote: > > > > + /* MSDN says: If hFile is a handle to a communications device, > > + * the function only flushes the transmit buffer. > > + */ > > + ret = (tcdrain( serial->obj.fd ) != -1); > > Hmm, doesn't that mean you should use tcflush() instead? Thanks, well spotted. Ciao, Marcus License: LGPL Changelog: Marcus Meissner <marcus@jet.franken.de> Protect InternetCloseHandle() against invalid handles. Index: serial.c =================================================================== RCS file: /home/wine/wine/server/serial.c,v retrieving revision 1.22 diff -u -r1.22 serial.c --- serial.c 30 May 2002 20:12:58 -0000 1.22 +++ serial.c 14 Jul 2002 15:14:57 -0000 @@ -55,6 +55,7 @@ static void serial_queue_async(struct object *obj, void *ptr, unsigned int status, int type, int count); static void destroy_serial(struct object *obj); static void serial_poll_event( struct object *obj, int event ); +static int serial_flush( struct object *obj ); struct serial { @@ -92,7 +93,7 @@ serial_get_poll_events, /* get_poll_events */ serial_poll_event, /* poll_event */ serial_get_fd, /* get_fd */ - no_flush, /* flush */ + serial_flush, /* flush */ serial_get_info, /* get_file_info */ serial_queue_async, /* queue_async */ destroy_serial /* destroy */ @@ -314,6 +315,21 @@ else set_error ( STATUS_INVALID_PARAMETER ); set_select_events ( obj, serial_get_poll_events ( obj )); +} + +static int serial_flush( struct object *obj ) +{ + int ret; + struct serial *serial = (struct serial *)grab_object(obj); + assert( obj->ops == &serial_ops ); + + /* MSDN says: If hFile is a handle to a communications device, + * the function only flushes the transmit buffer. + */ + ret = (tcflush( serial->obj.fd, TCOFLUSH ) != -1); + if (!ret) file_set_error(); + release_object( serial ); + return ret; } /* create a serial */