mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
glocalfile: Fix the global trash dir detection
The `g_file_trash` function fails with the `Unable to find or create trash directory` error when the global `.Trash` directory exists. This is because the commit7f2af262
introduced the `gboolean success` variable to signalize the detection of the trash folder, but didn't set it in all code branches. Since for a time this variable was not initialized the bug wasn't visible when the trash folder existed. The bug became effective after the `success` variable was initialized with `FALSE` by the commitc983ded0
. Let's explicitly set the `success` variable in all branches to fix the global trash dir detection. Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2439
This commit is contained in:
parent
cd93c350a2
commit
648994dba4
@ -2070,6 +2070,7 @@ g_local_file_trash (GFile *file,
|
||||
(global_stat.st_mode & S_ISVTX) != 0)
|
||||
{
|
||||
trashdir = g_build_filename (globaldir, uid_str, NULL);
|
||||
success = TRUE;
|
||||
|
||||
if (g_lstat (trashdir, &trash_stat) == 0)
|
||||
{
|
||||
@ -2079,12 +2080,14 @@ g_local_file_trash (GFile *file,
|
||||
/* Not a directory or not owned by user, ignore */
|
||||
g_free (trashdir);
|
||||
trashdir = NULL;
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
else if (g_mkdir (trashdir, 0700) == -1)
|
||||
{
|
||||
g_free (trashdir);
|
||||
trashdir = NULL;
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
g_free (globaldir);
|
||||
|
Loading…
Reference in New Issue
Block a user