utils: use strtol instead of atoi

HEX format is friendly to iSCSI utils, for example:
./iscsi-inq -e 0x1 -c 0xb1 iscsi://...

atoi supports decimal only, this example does not work.
Use strtol(nptr, NULL, 0) to auto-detect format, then this works fine.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
This commit is contained in:
zhenwei pi
2023-07-07 09:51:37 +08:00
committed by Bart Van Assche
parent 9ca47316f4
commit 6e2c677553
4 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
show_usage = 1;
break;
case 'd':
debug = atoi(optarg);
debug = strtol(optarg, NULL, 0);
break;
case 'i':
initiator = optarg;