summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2008-10-16 12:35:57 +0000
committerAlexander Larsson <alexl@src.gnome.org>2008-10-16 12:35:57 +0000
commitdcd101bb1baadffb552d96d67aa69eabe556ed42 (patch)
tree3ce875d1b6c5f71f601a50d91cde02843960ddb5
parentb78d193756b7200642b522e642e07ca59cbe3860 (diff)
downloadgvfs-dcd101bb1baadffb552d96d67aa69eabe556ed42.tar.gz
Set st_blocks & co so that du works (#554682) Patch from Andreas
2008-10-16 Alexander Larsson <alexl@redhat.com> * client/gvfsfusedaemon.c (getattr_for_file): Set st_blocks & co so that du works (#554682) Patch from Andreas Henriksson svn path=/branches/gnome-2-24/; revision=2050
-rw-r--r--ChangeLog6
-rw-r--r--client/gvfsfusedaemon.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f1a3fdf..83b237a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-16 Alexander Larsson <alexl@redhat.com>
+
+ * client/gvfsfusedaemon.c (getattr_for_file):
+ Set st_blocks & co so that du works (#554682)
+ Patch from Andreas Henriksson
+
2008-10-09 Alexander Larsson <alexl@redhat.com>
* client/gdaemonfileinputstream.c:
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c
index ef3314c3..aab58371 100644
--- a/client/gvfsfusedaemon.c
+++ b/client/gvfsfusedaemon.c
@@ -744,6 +744,13 @@ getattr_for_file (GFile *file, struct stat *sbuf)
if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_TIME_ACCESS))
sbuf->st_atime = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_TIME_ACCESS);
+ if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE))
+ sbuf->st_blksize = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE);
+ if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCKS))
+ sbuf->st_blocks = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_UNIX_BLOCKS);
+ else /* fake it to make 'du' work like 'du --apparent'. */
+ sbuf->st_blocks = (sbuf->st_size + 1) / 512;
+
/* Setting st_nlink to 1 for directories makes 'find' work */
sbuf->st_nlink = 1;