linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/shell: Fix non-interactive mode with no input stream
@ 2018-04-21 13:14 Tarvi Verro
  0 siblings, 0 replies; only message in thread
From: Tarvi Verro @ 2018-04-21 13:14 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Tarvi Verro

When the input stream doesn't support epoll, the non-interactive mode
should still print its output.

Showed up when a script was run as a systemd service. For testing
consider that the following command should report a version string:

btmgmt version < /dev/null
Version 5.49
---
 src/shared/shell.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index e7f17e021..aa20c30f7 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -460,9 +460,6 @@ void bt_shell_printf(const char *fmt, ...)
 	char *saved_line;
 	int saved_point;
 
-	if (!data.input)
-		return;
-
 	if (data.mode) {
 		va_start(args, fmt);
 		vprintf(fmt, args);
@@ -470,6 +467,9 @@ void bt_shell_printf(const char *fmt, ...)
 		return;
 	}
 
+	if (!data.input)
+		return;
+
 	save_input = !RL_ISSTATE(RL_STATE_DONE);
 
 	if (save_input) {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-21 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-21 13:14 [PATCH BlueZ] shared/shell: Fix non-interactive mode with no input stream Tarvi Verro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).