gvfs r2050 - in branches/gnome-2-24: . client



Author: alexl
Date: Thu Oct 16 12:35:57 2008
New Revision: 2050
URL: http://svn.gnome.org/viewvc/gvfs?rev=2050&view=rev

Log:
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



Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/client/gvfsfusedaemon.c

Modified: branches/gnome-2-24/client/gvfsfusedaemon.c
==============================================================================
--- branches/gnome-2-24/client/gvfsfusedaemon.c	(original)
+++ branches/gnome-2-24/client/gvfsfusedaemon.c	Thu Oct 16 12:35:57 2008
@@ -744,6 +744,13 @@
       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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]