summaryrefslogtreecommitdiff
path: root/client/gvfsfusedaemon.c
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 /client/gvfsfusedaemon.c
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
Diffstat (limited to 'client/gvfsfusedaemon.c')
-rw-r--r--client/gvfsfusedaemon.c7
1 files changed, 7 insertions, 0 deletions
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;