diff options
author | Christopher Faylor <me+cygwin@cgf.cx> | 2002-02-21 04:59:36 +0000 |
---|---|---|
committer | Christopher Faylor <me+cygwin@cgf.cx> | 2002-02-21 04:59:36 +0000 |
commit | 17f3cc778f71f0e9e522648d47a7cb06ef940509 (patch) | |
tree | 2326d5c8c0044c43d2e92614169c37df9198df12 /gdb/win32-nat.c | |
parent | bfa991262962ad43c9f0019816a396be3c0a7405 (diff) | |
download | gdb-17f3cc778f71f0e9e522648d47a7cb06ef940509.tar.gz |
* win32-nat.c (register_loaded_dll): Handle case where FindFirstFile fails.
Diffstat (limited to 'gdb/win32-nat.c')
-rw-r--r-- | gdb/win32-nat.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 610af6f74d2..871620fe386 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); |