]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix latent bug in ser_windows_send_break
authorTom Tromey <tromey@adacore.com>
Fri, 1 Sep 2023 17:04:58 +0000 (11:04 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 27 Nov 2023 19:55:14 +0000 (12:55 -0700)
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

gdb/ser-mingw.c

index c0aa5d8d0b9a0aa73be4fae361ba951f97aa92ab..806f3999385bff4089eb86b0193303db3227ec08 100644 (file)
@@ -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;