From 180da70291508c099a7f60f9a994488fc3137909 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sat, 23 Apr 2016 16:41:52 +0300 Subject: [PATCH] monitor: Permit monitor/mgmt socket errors if a TTY is used One may want to run btmon without special privileges when using it in TTY mode. Ignore any errors from control_tracing() in such a case. --- monitor/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/monitor/main.c b/monitor/main.c index 38e4fc9a1..be3d55e0f 100644 --- a/monitor/main.c +++ b/monitor/main.c @@ -224,10 +224,13 @@ int main(int argc, char *argv[]) if (ellisys_server) ellisys_enable(ellisys_server, ellisys_port); - if (tty) - control_tty(tty, tty_speed); + if (tty && control_tty(tty, tty_speed) < 0) + return EXIT_FAILURE; - if (control_tracing() < 0) + /* Accept error here if we have a successfully opened TTY + * (could happen if btmon is run as a normal user). + */ + if (control_tracing() < 0 && !tty) return EXIT_FAILURE; exit_status = mainloop_run(); -- 2.47.3