From: Kevin Buettner Date: Mon, 8 Dec 2003 17:00:06 +0000 (+0000) Subject: * remote.c (remote_open_1, remote_cisco_open): Avoid closing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b74d5d38586baed99d7422d48f760747a8e83cb;p=binutils-gdb.git * remote.c (remote_open_1, remote_cisco_open): Avoid closing remote_desc more than once. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 46063c8f935..1a2c0343385 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2003-12-08 Kevin Buettner + + * remote.c (remote_open_1, remote_cisco_open): Avoid closing + remote_desc more than once. + 2003-12-07 Andrew Cagney * defs.h (DEPRECATED_STREQN, DEPRECATED_STREQ): Simplify by diff --git a/gdb/remote.c b/gdb/remote.c index e44b932d9c0..1ed3680c707 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2299,7 +2299,12 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, { if (serial_setbaudrate (remote_desc, baud_rate)) { + /* The requested speed could not be set. Error out to + top level after closing remote_desc. Take care to + set remote_desc to NULL to avoid closing remote_desc + more than once. */ serial_close (remote_desc); + remote_desc = NULL; perror_with_name (name); } } @@ -5566,7 +5571,12 @@ remote_cisco_open (char *name, int from_tty) baud_rate = (baud_rate > 0) ? baud_rate : 9600; if (serial_setbaudrate (remote_desc, baud_rate)) { + /* The requested speed could not be set. Error out to + top level after closing remote_desc. Take care to + set remote_desc to NULL to avoid closing remote_desc + more than once. */ serial_close (remote_desc); + remote_desc = NULL; perror_with_name (name); }