summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-01-14 12:57:11 +0100
committerOndrej Holy <oholy@redhat.com>2020-01-14 13:48:14 +0100
commit709483017703ef07e725d9ee2de00e1fa8cc4883 (patch)
treefe1b57d42423167b2350d0b73192a69f353ceb13
parentca308667a11cd34d6e4afebee556619e7c5f7024 (diff)
downloadgvfs-709483017703ef07e725d9ee2de00e1fa8cc4883.tar.gz
fuse: Prevent abortions if modified time is not set
If `G_FILE_ATTRIBUTE_TIME_MODIFIED` is not set for some reason, the fuse daemon aborts as it expects that it is always set. Let's use g_file_info_has_attribute to prevent the crashes.
-rw-r--r--client/gvfsfusedaemon.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index 00bd9129..47f4e4c6 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -564,6 +564,7 @@ file_info_get_attribute_as_uint (GFileInfo *file_info, const gchar *attribute)
default:
uint_result = 0;
+ g_debug ("attribute: %s type: %d\n", attribute, attribute_type);
g_assert_not_reached ();
break;
}
@@ -743,9 +744,12 @@ set_attributes_from_info (GFileInfo *file_info, struct stat *sbuf)
sbuf->st_uid = daemon_uid;
sbuf->st_gid = daemon_gid;
- sbuf->st_mtime = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
- sbuf->st_ctime = sbuf->st_mtime;
- sbuf->st_atime = sbuf->st_mtime;
+ if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED))
+ {
+ sbuf->st_mtime = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ sbuf->st_ctime = sbuf->st_mtime;
+ sbuf->st_atime = sbuf->st_mtime;
+ }
if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_TIME_CHANGED))
sbuf->st_ctime = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_TIME_CHANGED);