From: Daniel Jacobowitz Date: Mon, 13 Jan 2003 20:27:51 +0000 (+0000) Subject: * source.c (openp): Squelch warning about "filename". X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2314e9da6e30306f7a142accbf8661c36dc6ceeb;p=thirdparty%2Fbinutils-gdb.git * source.c (openp): Squelch warning about "filename". * source.c (openp): If the file does not exist don't necessarily search the path. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de23b25b96e..7a36576836a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2003-01-13 Daniel Jacobowitz + + * source.c (openp): Squelch warning about "filename". + +2003-01-13 Daniel Jacobowitz + + * source.c (openp): If the file does not exist don't necessarily + search the path. + 2002-12-11 GDB Administrator * version.in: Bump to version 5.3.0.90. diff --git a/gdb/source.c b/gdb/source.c index c7c1ce2f5d2..491d1baf7cc 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -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;