applications: Don't recurse into symlinks when clearing cache

Oh boy... what can I say.

Sadly Builder symlinks to somewhere where we eventually end up in
the home folder. And delete all files.

:(

Pass the FTW_PHYS flag to nftw() so it doesn't follow symlinks.

Closes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2153
This commit is contained in:
Georges Basile Stavracas Neto 2022-12-21 13:43:18 -03:00
parent 5f4bfd567a
commit 543ba4d58a

View file

@ -53,7 +53,7 @@ file_remove_thread_func (GTask *task,
GFile *file = source_object; GFile *file = source_object;
g_autofree gchar *path = g_file_get_path (file); g_autofree gchar *path = g_file_get_path (file);
nftw (path, ftw_remove_cb, 20, FTW_DEPTH); nftw (path, ftw_remove_cb, 20, FTW_PHYS | FTW_DEPTH);
if (g_task_set_return_on_cancel (task, FALSE)) if (g_task_set_return_on_cancel (task, FALSE))
g_task_return_boolean (task, TRUE); g_task_return_boolean (task, TRUE);