[gjs] Ignore empty elements in the search path



commit 6c86e3317feea68a8b5f36d64d0738c9d2215d26
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Nov 20 13:08:33 2010 -0500

    Ignore empty elements in the search path
    
    We were treating empty elements in the search path as meaning the
    current directory. However, empty elements are easy to end up with
    by mistakes in path construction, and treating them as the current
    directory can result in extremely confusing results. If the current
    directory is actually meant, it can be specified as '.'.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=635368

 gjs/importer.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gjs/importer.c b/gjs/importer.c
index 4057e64..4c03582 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -547,6 +547,10 @@ do_import(JSContext  *context,
         if (!gjs_string_to_utf8(context, elem, &dirname))
             goto out; /* Error message already set */
 
+        /* Ignore empty path elements */
+        if (dirname[0] == '\0')
+            continue;
+
         /* Try importing __init__.js and loading the symbol from it */
         if (full_path)
             g_free(full_path);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]