diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2016-04-23 16:41:52 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2016-04-27 14:16:32 +0300 |
commit | 180da70291508c099a7f60f9a994488fc3137909 (patch) | |
tree | 2bce4c3b3d9ec7ffe91c1e8d1d7e4704b5fb5a33 /monitor/main.c | |
parent | 9dc47e653d5e46cd0e1f0b75f001dde22e2a446c (diff) | |
download | bluez-180da70291508c099a7f60f9a994488fc3137909.tar.gz |
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.
Diffstat (limited to 'monitor/main.c')
-rw-r--r-- | monitor/main.c | 9 |
1 files 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(); |