aboutsummaryrefslogtreecommitdiff
path: root/cutils.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2011-01-05 11:41:02 +0100
committerKevin Wolf <kwolf@redhat.com>2011-01-24 11:08:50 +0100
commit70b4f4bb05ff5e6812c6593eeefbd19bd61b517d (patch)
tree6f3cf4350dfb31281f93954c43363442cc3527ee /cutils.c
parentc90f1b3297943f2f142d8114bef1092f9ac9acef (diff)
Make strtosz() return int64_t instead of ssize_t
strtosz() needs to return a 64 bit type even on 32 bit architectures. Otherwise qemu-img will fail to create disk images >= 2GB Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cutils.c b/cutils.c
index 7984bc1ca4..4d2e27c13a 100644
--- a/cutils.c
+++ b/cutils.c
@@ -291,9 +291,9 @@ int fcntl_setfl(int fd, int flag)
* value must be terminated by whitespace, ',' or '\0'. Return -1 on
* error.
*/
-ssize_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
+int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
{
- ssize_t retval = -1;
+ int64_t retval = -1;
char *endptr, c, d;
int mul_required = 0;
double val, mul, integral, fraction;
@@ -365,7 +365,7 @@ ssize_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
goto fail;
}
}
- if ((val * mul >= ~(size_t)0) || val < 0) {
+ if ((val * mul >= INT64_MAX) || val < 0) {
goto fail;
}
retval = val * mul;
@@ -378,7 +378,7 @@ fail:
return retval;
}
-ssize_t strtosz(const char *nptr, char **end)
+int64_t strtosz(const char *nptr, char **end)
{
return strtosz_suffix(nptr, end, STRTOSZ_DEFSUFFIX_MB);
}