From: Tom Tromey Date: Fri, 1 Sep 2023 17:04:58 +0000 (-0600) Subject: Fix latent bug in ser_windows_send_break X-Git-Tag: binutils-2_42~821 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4dda9cc4b03788d1cf0416b39a3ab3780caf27fd;p=thirdparty%2Fbinutils-gdb.git Fix latent bug in ser_windows_send_break The ClearCommBreak documentation says: If the function fails, the return value is zero. ser_windows_send_break inverts this check. This has never been noticed because the caller doesn't check the result. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30770 --- diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c index c0aa5d8d0b9..806f3999385 100644 --- a/gdb/ser-mingw.c +++ b/gdb/ser-mingw.c @@ -137,7 +137,7 @@ ser_windows_send_break (struct serial *scb) /* Delay for 250 milliseconds. */ Sleep (250); - if (ClearCommBreak (h)) + if (ClearCommBreak (h) == 0) return -1; return 0;