aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fdisk.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/fdisk.c')
-rw-r--r--util-linux/fdisk.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index cdcba0a03..e47bc7324 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -169,9 +169,9 @@ typedef unsigned long long ullong;
* do not support more than 2^32 sectors
*/
typedef uint32_t sector_t;
-#if UINT_MAX == 4294967295
+#if UINT_MAX == 0xffffffff
# define SECT_FMT ""
-#elif ULONG_MAX == 4294967295
+#elif ULONG_MAX == 0xffffffff
# define SECT_FMT "l"
#else
# error Cant detect sizeof(uint32_t)
@@ -1616,7 +1616,10 @@ read_int(sector_t low, sector_t dflt, sector_t high, sector_t base, const char *
int minus = (*line_ptr == '-');
int absolute = 0;
- value = atoi(line_ptr + 1);
+ if (sizeof(value) <= sizeof(long))
+ value = strtoul(line_ptr + 1, NULL, 10);
+ else
+ value = strtoull(line_ptr + 1, NULL, 10);
/* (1) if 2nd char is digit, use_default = 0.
* (2) move line_ptr to first non-digit. */