Re: [Tracker] PATCH: Allow specifying user data & cache directory paths in DConf



Hi Jonatan,

When you do something like this:
+  if (cache_dir == NULL || g_strcmp0 (cache_dir, "") == 0) {
+    cache_dir = g_build_filename (g_get_user_cache_dir (),
+                                  "tracker",
+                                  NULL);
Then you can leak cache_dir in case cache_dir = strdup(""). This isn't allowed in Tracker's code. You did the same thing for data_dir.

I guess a simple ok-fix would be to put g_free(cache_dir) upfront the g_build_filename assignment. That works for NULL too, so it's fine that way.


Jonatan Pålsson schreef op 8/08/2013 15:42:
Hi list,

I would like to re-locate the user data directory and user cache.
Currently these directories are retrieved using g_get_user_data_dir ()
and g_get_user_cache_dir (), which in turn may be affected by the user
by setting appropriate XDG_* variables. I would however like a more
persistent setting, so I added the user-cache-dir and user-data-dir
keys to the org.freedesktop.Tracker.DB namespace in DConf.

The behavior of the two keys is similar. If the key is set, it takes
precedence over g_get_user_*_dir () and the supplied path is used for
storing the files. If the key is empty (the default setting), the old
behavior is preserved.

Please see the following patch:
https://github.com/Pelagicore/tracker-ivi/commit/213456024d686305d0f6a30b09fa81f04e601fdd

I also have a patch for setting the path to the ontology directory. I
will submit it in a different thread to keep the discussion separate.




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