[gvfs/nfs] Don't rely on masked attributes
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/nfs] Don't rely on masked attributes
- Date: Wed, 4 Feb 2015 22:06:14 +0000 (UTC)
commit e53cc6265637f4e07d2a4fb42af6cd62691dc512
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Wed Feb 4 22:03:51 2015 +0000
Don't rely on masked attributes
Don't retrieve information from a GFileInfo retrieved from a job because
it is masked. This means retrieving info from them does not work if the
attribute was not requested from the client.
daemon/gvfsbackendnfs.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gvfsbackendnfs.c b/daemon/gvfsbackendnfs.c
index 0782fb6..29353b8 100644
--- a/daemon/gvfsbackendnfs.c
+++ b/daemon/gvfsbackendnfs.c
@@ -456,6 +456,7 @@ static void
set_name_info (GFileInfo *info,
const char *mimetype,
const char *basename,
+ gboolean is_directory,
GFileAttributeMatcher *matcher)
{
char *free_mimetype = NULL;
@@ -497,7 +498,7 @@ set_name_info (GFileInfo *info,
GIcon *icon = NULL;
GIcon *symbolic_icon = NULL;
- if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+ if (is_directory)
{
icon = g_themed_icon_new ("folder");
symbolic_icon = g_themed_icon_new ("folder-symbolic");
@@ -1672,6 +1673,7 @@ enumerate_stat_cb (int err,
set_name_info (new_info,
mimetype,
g_file_info_get_name (info),
+ S_ISDIR (st->nfs_mode),
handle->op_job->attribute_matcher);
g_file_info_set_is_symlink (new_info, TRUE);
@@ -1859,7 +1861,11 @@ enumerate_cb (int err, struct nfs_context *ctx, void *data, void *private_data)
}
g_file_info_set_file_type (info, type);
- set_name_info (info, mimetype, d->name, op_job->attribute_matcher);
+ set_name_info (info,
+ mimetype,
+ d->name,
+ type == G_FILE_TYPE_DIRECTORY,
+ op_job->attribute_matcher);
if ((g_file_attribute_matcher_matches (op_job->attribute_matcher,
G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE) ||
@@ -2065,7 +2071,11 @@ stat_cb (int err, struct nfs_context *ctx, void *data, void *private_data)
{
basename = g_path_get_basename (op_job->filename);
}
- set_name_info (info, mimetype, basename, op_job->attribute_matcher);
+ set_name_info (info,
+ mimetype,
+ basename,
+ S_ISDIR (st->nfs_mode),
+ op_job->attribute_matcher);
g_free (basename);
if (g_file_attribute_matcher_matches (op_job->attribute_matcher,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]