diff options
author | Martin Szulecki | 2009-02-05 20:56:07 -0800 |
---|---|---|
committer | Matt Colyer | 2009-02-05 20:56:07 -0800 |
commit | 9f1cac20cfa68d4f892ddacdd9dc01c22f335bac (patch) | |
tree | 801f71baf868a4ab070a52afb4d494477fbddc9e /src/ifuse.c | |
parent | 3002547f1a9f5f3df026e9aaaff4c931e951ec27 (diff) | |
download | ifuse-9f1cac20cfa68d4f892ddacdd9dc01c22f335bac.tar.gz ifuse-9f1cac20cfa68d4f892ddacdd9dc01c22f335bac.tar.bz2 |
Fix ifuse_statfs to report correct free and total space of device.
Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src/ifuse.c')
-rw-r--r-- | src/ifuse.c | 8 |
1 files 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]); } |