aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2003-01-13 20:11:47 +0000
committerDaniel Jacobowitz <drow@false.org>2003-01-13 20:11:47 +0000
commit072b10225217d5ae073051998515a921c167ded5 (patch)
tree75b9301dce1a6b7b7da0066e75dfb94e02be4787 /gdb/source.c
parentb5e5c35c013aa9b106a2e94871d63fd31cb28aa8 (diff)
downloadgdb-072b10225217d5ae073051998515a921c167ded5.zip
gdb-072b10225217d5ae073051998515a921c167ded5.tar.gz
gdb-072b10225217d5ae073051998515a921c167ded5.tar.bz2
* source.c (openp): If the file does not exist don't necessarily
search the path.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gdb/source.c b/gdb/source.c
index c2991b5..e6cd3f3 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;