From c914e0cc47f31781bbf8bbc1bd98bd8861b166a4 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 21 Feb 2002 04:59:36 +0000 Subject: [PATCH] * win32-nat.c (register_loaded_dll): Handle case where FindFirstFile fails. --- gdb/ChangeLog | 5 +++++ gdb/win32-nat.c | 21 ++++++++++++--------- gdb/windows-nat.c | 21 ++++++++++++--------- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 063701c..e6cb3a0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-02-20 Christopher Faylor + + * win32-nat.c (register_loaded_dll): Handle case where FindFirstFile + fails. + 2002-02-20 Daniel Jacobowitz * jv-exp.y (parse_number): Change type of implicit longs diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 610af6f..871620f 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -582,16 +582,19 @@ register_loaded_dll (const char *name, DWORD load_addr) HANDLE h = FindFirstFile(name, &w32_fd); size_t len; - FindClose (h); - strcpy (buf, name); - if (GetCurrentDirectory (MAX_PATH + 1, cwd)) + if (h) { - p = strrchr (buf, '\\'); - if (p) - p[1] = '\0'; - SetCurrentDirectory (buf); - GetFullPathName (w32_fd.cFileName, MAX_PATH, buf, &p); - SetCurrentDirectory (cwd); + FindClose (h); + strcpy (buf, name); + if (GetCurrentDirectory (MAX_PATH + 1, cwd)) + { + p = strrchr (buf, '\\'); + if (p) + p[1] = '\0'; + SetCurrentDirectory (buf); + GetFullPathName (w32_fd.cFileName, MAX_PATH, buf, &p); + SetCurrentDirectory (cwd); + } } cygwin_conv_to_posix_path (buf, ppath); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 610af6f..871620f 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -582,16 +582,19 @@ register_loaded_dll (const char *name, DWORD load_addr) HANDLE h = FindFirstFile(name, &w32_fd); size_t len; - FindClose (h); - strcpy (buf, name); - if (GetCurrentDirectory (MAX_PATH + 1, cwd)) + if (h) { - p = strrchr (buf, '\\'); - if (p) - p[1] = '\0'; - SetCurrentDirectory (buf); - GetFullPathName (w32_fd.cFileName, MAX_PATH, buf, &p); - SetCurrentDirectory (cwd); + FindClose (h); + strcpy (buf, name); + if (GetCurrentDirectory (MAX_PATH + 1, cwd)) + { + p = strrchr (buf, '\\'); + if (p) + p[1] = '\0'; + SetCurrentDirectory (buf); + GetFullPathName (w32_fd.cFileName, MAX_PATH, buf, &p); + SetCurrentDirectory (cwd); + } } cygwin_conv_to_posix_path (buf, ppath); -- 2.7.4