diff options
author | Ondrej Holy <oholy@redhat.com> | 2023-03-06 13:38:40 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2023-03-06 14:33:39 +0100 |
commit | 448a163bee9906ba3937ea8cdb4a08afeb6f9dc3 (patch) | |
tree | 5cfd5e82ae8446cce81687ce66a002e22fcb6f34 | |
parent | e75ba524fde6adefac40a9cb45882c82341f7c3a (diff) | |
download | glib-448a163bee9906ba3937ea8cdb4a08afeb6f9dc3.tar.gz |
glocalfileinfo: Ensure that is-backup is always set
Currently, the `G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP` attribute is set
only when its value is `TRUE`. This is wrong with the latest changes as
the `GLib-GIO-CRITICAL **: 00:54:07.260: GFileInfo created without
standard::is-backup` errors are printed now from the
`g_file_info_get_is_backup` function among others. Let's set this
aattribute also when it is `FALSE`.
Related: https://gitlab.gnome.org/GNOME/glib/-/issues/2934
-rw-r--r-- | gio/glocalfileinfo.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 7b9e90b8f..2d2c4e1dd 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -2049,9 +2049,10 @@ _g_local_file_info_get (const char *basename, file_is_hidden (path, basename)))); } - if (basename != NULL && basename[strlen (basename) -1] == '~' && - (stat_ok && S_ISREG (_g_stat_mode (&statbuf)))) - _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_STANDARD_IS_BACKUP, TRUE); + _g_file_info_set_attribute_boolean_by_id (info, + G_FILE_ATTRIBUTE_ID_STANDARD_IS_BACKUP, + basename != NULL && basename[strlen (basename) - 1] == '~' && + (stat_ok && S_ISREG (_g_stat_mode (&statbuf)))); #else if (statbuf.attributes & FILE_ATTRIBUTE_HIDDEN) g_file_info_set_is_hidden (info, TRUE); |