From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14429 invoked by alias); 15 Mar 2002 00:07:38 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 14368 invoked from network); 15 Mar 2002 00:07:35 -0000 Received: from unknown (HELO mufasa.cygnus.com) (205.180.230.184) by sources.redhat.com with SMTP; 15 Mar 2002 00:07:35 -0000 Received: (from rth@localhost) by mufasa.cygnus.com (8.11.2/8.11.2) id g2F07OR06086; Thu, 14 Mar 2002 16:07:24 -0800 X-Authentication-Warning: mufasa.cygnus.com: rth set sender to rth@redhat.com using -f Date: Thu, 14 Mar 2002 16:07:00 -0000 From: rth@redhat.com To: Andrew Cagney Cc: Richard Earnshaw , gdb-patches@sources.redhat.com Subject: Re: declare canonicalize_file_name Message-ID: <20020314160724.A5976@redhat.com> References: <20020314132845.A25190@redhat.com> <3C912539.4010009@cygnus.com> <20020314145602.B25218@redhat.com> <3C9135BB.4090401@cygnus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3C9135BB.4090401@cygnus.com>; from ac131313@cygnus.com on Thu, Mar 14, 2002 at 06:43:55PM -0500 X-SW-Source: 2002-03/txt/msg00226.txt.bz2 On Thu, Mar 14, 2002 at 06:43:55PM -0500, Andrew Cagney wrote: > Oops, ulgh! if RichardE tweeks to code (as I suggested) to simply prefer > realpath() it will break the hurd again. I think prefering realpath() > is correct (only use an obscure function when forced too) but that logic > is going to need to be scrambled a bit more :-(. What about something like this? r~ Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.68 diff -c -p -d -r1.68 utils.c *** utils.c 2002/03/01 06:19:24 1.68 --- utils.c 2002/03/15 00:06:43 *************** extern PTR realloc (); *** 81,86 **** --- 81,91 ---- #ifdef NEED_DECLARATION_FREE extern void free (); #endif + /* Actually, we'll never have the decl, since we don't define _GNU_SOURCE. */ + #if defined(HAVE_CANONICALIZE_FILE_NAME) \ + && defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME) + extern char *canonicalize_file_name (const char *); + #endif #undef XMALLOC #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) *************** string_to_core_addr (const char *my_stri *** 2532,2551 **** char * gdb_realpath (const char *filename) { ! #ifdef HAVE_CANONICALIZE_FILE_NAME ! return canonicalize_file_name (filename); ! #elif defined (HAVE_REALPATH) ! #if defined (PATH_MAX) char buf[PATH_MAX]; ! #elif defined (MAXPATHLEN) char buf[MAXPATHLEN]; ! #elif defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA) char *buf = alloca ((size_t)pathconf ("/", _PC_PATH_MAX)); ! #else ! #error "Neither PATH_MAX nor MAXPATHLEN defined" ! #endif char *rp = realpath (filename, buf); return xstrdup (rp ? rp : filename); #else return xstrdup (filename); #endif --- 2537,2560 ---- char * gdb_realpath (const char *filename) { ! #if defined(HAVE_REALPATH) ! # if defined (PATH_MAX) char buf[PATH_MAX]; ! # define USE_REALPATH ! # elif defined (MAXPATHLEN) char buf[MAXPATHLEN]; ! # define USE_REALPATH ! # elif defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA) char *buf = alloca ((size_t)pathconf ("/", _PC_PATH_MAX)); ! # define USE_REALPATH ! # endif ! #endif /* HAVE_REALPATH */ ! ! #if defined(USE_REALPATH) char *rp = realpath (filename, buf); return xstrdup (rp ? rp : filename); + #elif defined(HAVE_CANONICALIZE_FILE_NAME) + return canonicalize_file_name (filename); #else return xstrdup (filename); #endif