[tracker] tracker_file_system_get_remaining_space: use proper units
- From: Antoine Jacoutot <ajacoutot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker_file_system_get_remaining_space: use proper units
- Date: Tue, 10 May 2016 05:53:26 +0000 (UTC)
commit 6c97d3df87e594549cbc84676596f49ae7ade6c0
Author: Antoine Jacoutot <ajacoutot gnome org>
Date: Tue May 10 07:52:45 2016 +0200
tracker_file_system_get_remaining_space: use proper units
The fields of type fsblkcnt_t must be reported in units of f_frsize for
statvfs() and f_bsize for statfs().
https://bugzilla.gnome.org/show_bug.cgi?id=766137
src/libtracker-common/tracker-file-utils.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index 2c92179..a45f4b3 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -240,6 +240,8 @@ tracker_file_get_mime_type (GFile *file)
#ifdef __linux__
+#define __bsize f_bsize
+
#ifdef __USE_LARGEFILE64
#define __statvfs statfs64
#else
@@ -248,6 +250,8 @@ tracker_file_get_mime_type (GFile *file)
#else /* __linux__ */
+#define __bsize f_frsize
+
#if HAVE_STATVFS64
#define __statvfs statvfs64
#else
@@ -294,7 +298,8 @@ tracker_file_system_get_remaining_space (const gchar *path)
if (statvfs_helper (path, &st)) {
available = (geteuid () == 0) ? st.f_bfree : st.f_bavail;
- return st.f_bsize * available;
+ /* __bsize is a platform dependent #define above */
+ return st.__bsize * available;
} else {
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]