Diff between d8febc76a43fa104457d8167379787949fff8f89 and f8c3a38e4fe943eaed677a295663426cb7241e0e

Changed Files

File Additions Deletions Status
src/shared/shell.c +6 -1 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 4658819..0639c78 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1101,6 +1101,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
 	struct option options[256];
 	char optstr[256];
 	size_t offset;
+	char *endptr = NULL;
 
 	offset = sizeof(main_options) / sizeof(struct option);
 
@@ -1132,7 +1133,11 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
 			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;