[tracker] libtracker-miner: don't crash when first indexing files out of /home



commit 133c5894a29c7e09681d9b54871abe5fe5e45ae1
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Feb 26 23:27:02 2013 -0500

    libtracker-miner: don't crash when first indexing files out of /home
    
    If tracker_miner_manager_index_file() is called with a path outside of
    the home directory, we'll end up recursing up to the file system root,
    to create the parent directory objects.
    
    When the tree we're passed is the filesystem root, and the file is
    exactly equal to it, we should return the tree root immediately, or
    we'll crash later in the while loop.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694783

 src/libtracker-miner/tracker-file-system.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-system.c b/src/libtracker-miner/tracker-file-system.c
index 193a8d4..fecdc05 100644
--- a/src/libtracker-miner/tracker-file-system.c
+++ b/src/libtracker-miner/tracker-file-system.c
@@ -264,6 +264,16 @@ file_tree_lookup (GNode     *tree,
                        g_free (uri);
                        return NULL;
                }
+
+               /* Second check there is no basename and if there isn't,
+                * then this node MUST be the closest registered node
+                * we can use for the uri. The difference here is that
+                * we return tree not NULL.
+                */
+               else if (ptr[0] == '\0') {
+                       g_free (uri);
+                       return tree;
+                }
        }
 
        parent = tree;


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