Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Unmetafy of getsparam()



On Sun, 19 Jul 2015 01:13:54 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> @@ -4020,7 +4029,7 @@ void
>  langsetfn(Param pm, char *x)
>  {
>      strsetfn(pm, x);
> -    setlang(x);
> +    setlang(unmeta(x));
>  }

This is giving me an instant segmentation violation on one system.

I think the best fix is for unmeta() to adopt the behaviour of checking
and returning NULL immediately.

pws

diff --git a/Src/utils.c b/Src/utils.c
index ba90564..0acab88 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4401,7 +4401,10 @@ unmeta(const char *file_name)
     char *p;
     const char *t;
     int newsz, meta;
-    
+
+    if (!file_name)
+	return NULL;
+
     meta = 0;
     for (t = file_name; *t; t++) {
 	if (*t == Meta)



Messages sorted by: Reverse Date, Date, Thread, Author