From c10b34ed19524a4d68d51cbf512398c2863310b8 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 4 Oct 2006 18:20:25 +0000 Subject: [PATCH] Use strtoll(3) instead of strtol(3) for the starting block or partition size. On 32-bit platforms sizeof(long) < sizeof(off_t) and using strtol(3) would prevent partitions larger than 4G sectors or beyond 4G blocks. PR: bin/103991 MFC after: 3 days --- sbin/gpt/add.c | 4 ++-- sbin/gpt/label.c | 4 ++-- sbin/gpt/remove.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/gpt/add.c b/sbin/gpt/add.c index 37c6bc97e50b..348989fb7e2a 100644 --- a/sbin/gpt/add.c +++ b/sbin/gpt/add.c @@ -163,7 +163,7 @@ cmd_add(int argc, char *argv[]) case 'b': if (block > 0) usage_add(); - block = strtol(optarg, &p, 10); + block = strtoll(optarg, &p, 10); if (*p != 0 || block < 1) usage_add(); break; @@ -177,7 +177,7 @@ cmd_add(int argc, char *argv[]) case 's': if (size > 0) usage_add(); - size = strtol(optarg, &p, 10); + size = strtoll(optarg, &p, 10); if (*p != 0 || size < 1) usage_add(); break; diff --git a/sbin/gpt/label.c b/sbin/gpt/label.c index 98cbcc734fe8..4a793cd1cc12 100644 --- a/sbin/gpt/label.c +++ b/sbin/gpt/label.c @@ -184,7 +184,7 @@ cmd_label(int argc, char *argv[]) case 'b': if (block > 0) usage_label(); - block = strtol(optarg, &p, 10); + block = strtoll(optarg, &p, 10); if (*p != 0 || block < 1) usage_label(); break; @@ -208,7 +208,7 @@ cmd_label(int argc, char *argv[]) case 's': if (size > 0) usage_label(); - size = strtol(optarg, &p, 10); + size = strtoll(optarg, &p, 10); if (*p != 0 || size < 1) usage_label(); break; diff --git a/sbin/gpt/remove.c b/sbin/gpt/remove.c index 0515fc1f5a78..381ff0b8217f 100644 --- a/sbin/gpt/remove.c +++ b/sbin/gpt/remove.c @@ -155,7 +155,7 @@ cmd_remove(int argc, char *argv[]) case 'b': if (block > 0) usage_remove(); - block = strtol(optarg, &p, 10); + block = strtoll(optarg, &p, 10); if (*p != 0 || block < 1) usage_remove(); break; @@ -169,7 +169,7 @@ cmd_remove(int argc, char *argv[]) case 's': if (size > 0) usage_remove(); - size = strtol(optarg, &p, 10); + size = strtoll(optarg, &p, 10); if (*p != 0 || size < 1) usage_remove(); break;