GLocalFile: add error handle for trash info file writing

This commit is contained in:
wangrong 2022-12-29 12:33:55 +00:00 committed by Philip Withnall
parent f0bc060e89
commit 95c4312941

View File

@ -2278,9 +2278,18 @@ g_local_file_trash (GFile *file,
original_name_escaped, delete_time);
g_free (delete_time);
g_file_set_contents_full (infofile, data, -1,
if (!g_file_set_contents_full (infofile, data, -1,
G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING,
0600, NULL);
0600, error))
{
g_unlink (infofile);
g_free (filesdir);
g_free (trashname);
g_free (infofile);
return FALSE;
}
/* TODO: Maybe we should verify that you can delete the file from the trash
* before moving it? OTOH, that is hard, as it needs a recursive scan