Message ID | 20240704102617.1132337-5-hadess@hadess.net |
---|---|
State | Superseded |
Headers | show |
Series | Fix a number of static analysis issues #5 | expand |
diff --git a/src/shared/shell.c b/src/shared/shell.c index c09d41ee54df..d500dddf8acf 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1306,11 +1306,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, + if (data.init_fd < 0) + printf("Unable to open %s: %s (%d)\n", optarg, strerror(errno), errno); + } break; case 't': if (optarg)