diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2009-05-20 18:00:53 -0500 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2009-05-20 18:00:53 -0500 |
commit | c19c424e2dadc19c4e32a064a42966e49375b918 (patch) | |
tree | f470d849d876605608df73e431c1965e02b4293a /usr/sysfs.c | |
parent | 524175bb14281277a5c8cc419c72c2f38fccdc87 (diff) | |
download | open-iscsi-c19c424e2dadc19c4e32a064a42966e49375b918.tar.gz |
iscsi sysfs: fix compilation warning about unsigned long long cast
uint64_t can be unsigned long long or unsigned long depending on the
arch. This just has us use sscanf with PRIu64 to read in our uint64_t.
Diffstat (limited to 'usr/sysfs.c')
-rw-r--r-- | usr/sysfs.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/usr/sysfs.c b/usr/sysfs.c index 112a73a..7c743e6 100644 --- a/usr/sysfs.c +++ b/usr/sysfs.c @@ -27,6 +27,7 @@ #include <ctype.h> #include <errno.h> #include <limits.h> +#include <inttypes.h> #include <sys/stat.h> #include "log.h" @@ -620,8 +621,7 @@ int sysfs_get_str(char *id, char *subsys, char *param, char *value, return 0; } -int sysfs_get_ull(char *id, char *subsys, char *param, - unsigned long long *value) +int sysfs_get_uint64(char *id, char *subsys, char *param, uint64_t *value) { char *sysfs_value; @@ -630,10 +630,8 @@ int sysfs_get_ull(char *id, char *subsys, char *param, if (!sysfs_value) return EIO; - errno = 0; - *value = strtoull(sysfs_value, NULL, 0); - if (errno) - return errno; + if (sscanf(sysfs_value, "%" PRIu64 "\n", value) != 1) + return EINVAL; return 0; } |