From: Daniel Jacobowitz Date: Mon, 13 Jan 2003 20:11:47 +0000 (+0000) Subject: * source.c (openp): If the file does not exist don't necessarily X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=072b10225217d5ae073051998515a921c167ded5;p=binutils-gdb.git * source.c (openp): If the file does not exist don't necessarily search the path. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de950fe6815..e4da29efc15 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2003-01-13 Daniel Jacobowitz + + * source.c (openp): If the file does not exist don't necessarily + search the path. + 2003-01-13 Daniel Jacobowitz Fix PR gdb/872. diff --git a/gdb/source.c b/gdb/source.c index c2991b5bfd1..e6cd3f36a2f 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -674,14 +674,21 @@ openp (const char *path, int try_cwd_first, const char *string, mode |= O_BINARY; #endif - if ((try_cwd_first || IS_ABSOLUTE_PATH (string)) && is_regular_file (string)) + if (try_cwd_first || IS_ABSOLUTE_PATH (string)) { int i; - filename = alloca (strlen (string) + 1); - strcpy (filename, string); - fd = open (filename, mode, prot); - if (fd >= 0) - goto done; + + if (is_regular_file (string)) + { + filename = alloca (strlen (string) + 1); + strcpy (filename, string); + fd = open (filename, mode, prot); + if (fd >= 0) + goto done; + } + else + fd = -1; + for (i = 0; string[i]; i++) if (IS_DIR_SEPARATOR (string[i])) goto done;