util/cbfstool/ifittool: use strtol function instead of atoi

Fix error "Invalid option -A" by adding "A" to options list.

Also, atoi does not parse hex string, for instance 0x200 is interpreted as 0,
and this causes a failure when updating second FIT table using -j option.
Use strtol instead of atoi

BUG=none
BRANCH=none
TEST=Build and boot hatch after enabling dual bootblock feature.

Change-Id: Ib227437f88ffcccda1ce2f20a9ab098e5aa091c7
Signed-off-by: Pandya, Varshit B <varshit.b.pandya@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33937
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Reviewed-by: Subrata Banik <subrata.banik@intel.com>
This commit is contained in:
Pandya, Varshit B 2019-07-01 16:27:01 +05:30 committed by Philipp Deppenwiese
parent b6b5e7fb45
commit 36cc664bc7
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@
/* Global variables */
partitioned_file_t *image_file;
static const char *optstring = "H:j:f:r:d:t:n:s:caDvh?";
static const char *optstring = "H:j:f:r:d:t:n:s:cAaDvh?";
static struct option long_options[] = {
{"file", required_argument, 0, 'f' },
{"region", required_argument, 0, 'r' },
@ -230,7 +230,7 @@ int main(int argc, char *argv[])
}
break;
case 'j':
topswap_size = atoi(optarg);
topswap_size = strtol(optarg, NULL, 0);
if (!is_valid_topswap(topswap_size))
return 1;
break;