From 9f1cac20cfa68d4f892ddacdd9dc01c22f335bac Mon Sep 17 00:00:00 2001
From: Martin Szulecki
Date: Thu, 5 Feb 2009 20:56:07 -0800
Subject: Fix ifuse_statfs to report correct free and total space of device.

Signed-off-by: Matt Colyer <matt@colyer.name>
---
 src/ifuse.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/ifuse.c b/src/ifuse.c
index 92ab741..1ec1569 100644
--- a/src/ifuse.c
+++ b/src/ifuse.c
@@ -29,6 +29,7 @@
 #include <glib.h>
 #include <unistd.h>
 #include <stdint.h>
+#include <stdlib.h>
 
 typedef uint32_t uint32;		// this annoys me too
 
@@ -212,7 +213,8 @@ int ifuse_statfs(const char *path, struct statvfs *stats)
 {
 	iphone_afc_client_t afc = fuse_get_context()->private_data;
 	char **info_raw = NULL;
-	uint32_t totalspace = 0, freespace = 0, blocksize = 0, i = 0;
+	uint64_t totalspace = 0, freespace = 0;
+	int i = 0, blocksize = 0;
 
 	iphone_afc_get_devinfo(afc, &info_raw);
 	if (!info_raw)
@@ -220,9 +222,9 @@ int ifuse_statfs(const char *path, struct statvfs *stats)
 
 	for (i = 0; info_raw[i]; i++) {
 		if (!strcmp(info_raw[i], "FSTotalBytes")) {
-			totalspace = atoi(info_raw[i + 1]);
+			totalspace = strtoull(info_raw[i + 1], (char **)NULL, 10);
 		} else if (!strcmp(info_raw[i], "FSFreeBytes")) {
-			freespace = atoi(info_raw[i + 1]);
+			freespace = strtoull(info_raw[i + 1], (char **)NULL, 10);
 		} else if (!strcmp(info_raw[i], "FSBlockSize")) {
 			blocksize = atoi(info_raw[i + 1]);
 		}
-- 
cgit v1.1-32-gdbae