linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tarvi Verro <tarvi.verro@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Tarvi Verro <tarvi.verro@gmail.com>
Subject: [PATCH BlueZ] shared/shell: Fix non-interactive mode with no input stream
Date: Sat, 21 Apr 2018 15:14:06 +0200	[thread overview]
Message-ID: <20180421131406.6415-1-tarvi.verro@gmail.com> (raw)

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


                 reply	other threads:[~2018-04-21 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180421131406.6415-1-tarvi.verro@gmail.com \
    --to=tarvi.verro@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).