Blob Blame History Raw
http://sourceware.org/ml/gdb-patches/2012-05/msg00449.html
Subject: [patch] Cosmetic fix 'show auto-load safe-path' for ":"  [Re: [patch 1/2] Provide $ddir substitution for --with-auto-load-safe-path]

On Fri, 11 May 2012 21:33:53 +0200, Jan Kratochvil wrote:
> On Fri, 11 May 2012 21:14:47 +0200, Pedro Alves wrote:
> > Looks like there is some special casing somewhere:
> 
> True, I forgot and I agree.  But it is only this "cosmetic" message, it has no
> functionality effect.  I can fix this "any directory" message conditional.

Regards,
Jan


gdb/
2012-05-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* auto-load.c (show_auto_load_safe_path): Accept any combination of
	DIRNAME_SEPARATOR and IS_DIR_SEPARATOR for wild-match.

diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 5ee117f..462ee06 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -241,7 +241,15 @@ static void
 show_auto_load_safe_path (struct ui_file *file, int from_tty,
 			  struct cmd_list_element *c, const char *value)
 {
-  if (strcmp (value, "/") == 0)
+  const char *cs;
+
+  /* Check if user has entered either "/" or for example ":".
+     But while more complicate content like ":/foo" would still also
+     permit any location do not hide those.  */
+
+  for (cs = value; *cs && (*cs == DIRNAME_SEPARATOR || IS_DIR_SEPARATOR (*cs));
+       cs++);
+  if (*cs == 0)
     fprintf_filtered (file, _("Auto-load files are safe to load from any "
 			      "directory.\n"));
   else