From 47ed8c1a3cb8e580b4e878c1a7676ac71ec1ef2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Wed, 11 May 2016 14:55:19 +0200 Subject: [PATCH] gps: fix thread initialization under posix under NuttX the argc in task_main_trampoline contains two arguments, but on linux only one. --- src/drivers/gps/gps.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index 982607855a..ff359146cb 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -297,6 +297,7 @@ int GPS::init() if (_task < 0) { PX4_WARN("task start failed: %d", errno); + _task = -1; return -errno; } @@ -305,7 +306,7 @@ int GPS::init() void GPS::task_main_trampoline(int argc, char *argv[]) { - g_dev[argv[1][0] - '1']->task_main(); + g_dev[argv[argc - 1][0] - '1']->task_main(); } int GPS::callback(GPSCallbackType type, void *data1, int data2, void *user)