* remote.c (minitelnet): Don't redeclare escape_count, echo_check.
[binutils-gdb.git] / gdb / source.c
index c2991b5bfd1f995acb74ef3ed33e3a440ec59765..c2269fadcd5bd6737820486a19a4edc8e938e641 100644 (file)
@@ -1,6 +1,6 @@
 /* List lines of source files for GDB, the GNU debugger.
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -674,14 +674,24 @@ 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
+       {
+         filename = NULL;
+         fd = -1;
+       }
+
       for (i = 0; string[i]; i++)
        if (IS_DIR_SEPARATOR (string[i]))
          goto done;