]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* source.c (openp): Squelch warning about "filename".
authorDaniel Jacobowitz <drow@false.org>
Mon, 13 Jan 2003 20:27:51 +0000 (20:27 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 13 Jan 2003 20:27:51 +0000 (20:27 +0000)
* source.c (openp): If the file does not exist don't necessarily
search the path.

gdb/ChangeLog
gdb/source.c

index de23b25b96e9c586931dd0cbed7e2e5fbd36e6a9..7a36576836ac6bc71b206341218bcc994a6b9650 100644 (file)
@@ -1,3 +1,12 @@
+2003-01-13  Daniel Jacobowitz  <drow@mvista.com>
+
+       * source.c (openp): Squelch warning about "filename".
+
+2003-01-13  Daniel Jacobowitz  <drow@mvista.com>
+
+       * source.c (openp): If the file does not exist don't necessarily
+       search the path.
+
 2002-12-11  GDB Administrator  <gdbadmin@sourceware.org>
 
        * version.in: Bump to version 5.3.0.90.
index c7c1ce2f5d29e1723ba24c9893f72d911df31f31..491d1baf7cc55e0755345ac3fec5b1a1cf76ce5f 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.
@@ -562,14 +562,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;