glocalfile: Set various file attributes if their value is FALSE

Following on from #2907, set various boolean attributes if they have
been requested, or are known for sure, and their value is `FALSE`.

Previously the `FALSE` value would have been implicitly returned by the
getter function, but now doing that without the attribute being
explicitly set will trigger a critical warning.

*Don’t* set these attributes if their value is unknown or there was an
error querying it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2934
This commit is contained in:
Philip Withnall
2023-03-06 14:36:26 +00:00
parent e75ba524fd
commit 8c473c5353
2 changed files with 13 additions and 14 deletions

View File

@@ -845,10 +845,10 @@ get_mount_info (GFileInfo *fs_info,
G_UNLOCK (mount_info_hash);
}
if (mount_info & MOUNT_INFO_READONLY &&
g_file_attribute_matcher_matches (matcher,
if (g_file_attribute_matcher_matches (matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_READONLY))
g_file_info_set_attribute_boolean (fs_info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE);
g_file_info_set_attribute_boolean (fs_info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
(mount_info & MOUNT_INFO_READONLY));
if (g_file_attribute_matcher_matches (matcher,
G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE))