Bail out if we can't find GPS device
authorPetr Štetiar <ynezz@true.cz>
Wed, 27 Jul 2016 12:45:50 +0000 (14:45 +0200)
committerJohn Crispin <john@phrozen.org>
Sun, 24 Jul 2016 04:12:36 +0000 (06:12 +0200)
Signed-off-by: Petr Štetiar <ynezz@true.cz>
main.c

diff --git a/main.c b/main.c
index 87d069be02112ecd1e1d75884bf9bbc713ce85a4..6ff4c173dab1ca08bafdd6e179cd6d6d0a09bc84 100644 (file)
--- a/main.c
+++ b/main.c
@@ -145,7 +145,10 @@ main(int argc, char ** argv)
        conn.path = ubus_socket;
        conn.cb = ubus_connect_handler;
        ubus_auto_connect(&conn);
-       nmea_open(argv[1], &stream, B4800);
+
+       if (nmea_open(device, &stream, B4800) < 0)
+               return -1;
+
        uloop_run();
        uloop_done();