This fixes the following error:
src/shared/shell.c:1135:19: warning: Null pointer passed to 1st
parameter expecting 'nonnull'
data.timeout = atoi(optarg);
^~~~~~~~~~~~
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
struct option options[256];
char optstr[256];
size_t offset;
+ char *endptr = NULL;
offset = sizeof(main_options) / sizeof(struct option);
data.mode = 1;
goto done;
case 't':
- data.timeout = atoi(optarg);
+ if (optarg)
+ data.timeout = strtol(optarg, &endptr, 0);
+
+ if (!endptr || *endptr != '\0')
+ printf("Unable to parse timeout\n");
break;
case 'z':
data.zsh = 1;