Diff between 176cf2e12a289f9f94666e188c79fa6cc1ff249b and 2433842ea33bcb80a9c157cbac472efedae8c8d4

Changed Files

File Additions Deletions Status
src/shared/shell.c +5 -4 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index add4fa1..73caa77 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1302,11 +1302,12 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
 			data.mode = 1;
 			goto done;
 		case 's':
-			if (optarg)
+			if (optarg && data.init_fd < 0) {
 				data.init_fd = open(optarg, O_RDONLY);
-			if (data.init_fd < 0)
-				printf("Unable to open %s: %s (%d)\n", optarg,
-						strerror(errno), errno);
+				if (data.init_fd < 0)
+					printf("Unable to open %s: %s (%d)\n",
+						optarg, strerror(errno), errno);
+			}
 			break;
 		case 't':
 			if (optarg)