From: Jan Kratochvil Date: Wed, 2 May 2012 20:00:36 +0000 (+0000) Subject: gdb/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1ef7171746433c3161d7d4b3c50a93f67d52c4a2;p=binutils-gdb.git gdb/ Fix --without-auto-load-safe-path for MS-Windows host platform. * auto-load.c (filename_is_in_dir): Return 1 for DIR_LEN 0. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5356e14008e..e544f898ae1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-05-02 Jan Kratochvil + + Fix --without-auto-load-safe-path for MS-Windows host platform. + * auto-load.c (filename_is_in_dir): Return 1 for DIR_LEN 0. + 2012-05-02 Eli Zaretskii * gdb_curses.h: Undefine KEY_EVENT before including curses diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 9d19179feb9..187e8520f9a 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -231,6 +231,12 @@ filename_is_in_dir (const char *filename, const char *dir) while (dir_len && IS_DIR_SEPARATOR (dir[dir_len - 1])) dir_len--; + /* Ensure auto_load_safe_path "/" matches any FILENAME. On MS-Windows + platform FILENAME even after gdb_realpath does not have to start with + IS_DIR_SEPARATOR character, such as the 'C:\x.exe' filename. */ + if (dir_len == 0) + return 1; + return (filename_ncmp (dir, filename, dir_len) == 0 && (IS_DIR_SEPARATOR (filename[dir_len]) || filename[dir_len] == '\0'));