File gvfs-support-nop-ftruncate.patch of Package gvfs.535
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index feef24d..42a18b0 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -1806,26 +1806,16 @@ vfs_rmdir (const gchar *path)
}
static gboolean
-file_handle_get_size (FileHandle *fh,
+file_get_size (GFile *file,
goffset *size)
{
- GFileInfo *info;
+ GFileInfo *info = NULL;
+ GError *error = NULL;
gboolean res;
-
- if (fh->stream == NULL)
- return FALSE;
- info = NULL;
- if (fh->op == FILE_OP_READ)
- info = g_file_input_stream_query_info (fh->stream,
- G_FILE_ATTRIBUTE_STANDARD_SIZE,
- NULL, NULL);
- else if (fh->op == FILE_OP_WRITE)
- info = g_file_output_stream_query_info (fh->stream,
- G_FILE_ATTRIBUTE_STANDARD_SIZE,
- NULL, NULL);
-
res = FALSE;
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL, &error);
+
if (info)
{
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE))
@@ -1835,6 +1825,12 @@ file_handle_get_size (FileHandle *fh,
}
g_object_unref (info);
}
+
+ if (error)
+ {
+ g_error_free (error);
+ }
+
return res;
}
@@ -1906,7 +1902,7 @@ vfs_ftruncate (const gchar *path, off_t size, struct fuse_file_info *fi)
fh->stream = NULL;
}
}
- else if (file_handle_get_size (fh, ¤t_size))
+ else if (file_get_size (file, ¤t_size))
{
if (current_size == size)
{