diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 30ea97b..c5e98ef 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -930,7 +930,8 @@ set_info_from_stat (GFileInfo             *info,
 #endif
 
   g_file_info_set_file_type (info, file_type);
-  g_file_info_set_size (info, statbuf->st_size);
+  g_file_info_set_size (info, (file_type == G_FILE_TYPE_REGULAR && statbuf->st_blocks)? statbuf->st_size: 0);
+
 
   _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_DEVICE, statbuf->st_dev);
 #ifndef G_OS_WIN32
