diff mbox

[1/2] Fix for "Added runtime selection of gps device"

Message ID 1452431658-13570-1-git-send-email-axilirator@gmail.com
State New
Headers show

Commit Message

Vadim Yanitskiy Jan. 10, 2016, 1:14 p.m. UTC
From: Яницкий Ва дим <axilirator@gmail.com>

The 'gps host HOST:PORT' line in the config file now is generated correctly.
So that it is parsed correctly when loading the config on next startup.
Also the gpsd port now is parsed as it should without a colon.
---
 src/host/layer23/src/mobile/vty_interface.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index 5782a17..73aaa78 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1075,7 +1075,7 @@  DEFUN(cfg_gps_host, cfg_gps_host_cmd, "gps host HOST:PORT",
 	if (colon != NULL) {
 		memcpy(g.gpsd_host, argv[0], colon - argv[0] - 1);
 		g.gpsd_host[colon - argv[0]] = '\0';
-		memcpy(g.gpsd_port, colon, strlen(colon));
+		memcpy(g.gpsd_port, colon + 1, strlen(colon));
 		g.gpsd_port[strlen(colon)] = '\0';
 	} else {
 		snprintf(g.gpsd_host, ARRAY_SIZE(g.gpsd_host), "%s", argv[0]);
@@ -1499,8 +1499,7 @@  static int config_write(struct vty *vty)
 	struct osmocom_ms *ms;
 
 #ifdef _HAVE_GPSD
-	vty_out(vty, "gpsd host %s%s", g.gpsd_host, VTY_NEWLINE);
-	vty_out(vty, "gpsd port %s%s", g.gpsd_port, VTY_NEWLINE);
+	vty_out(vty, "gps host %s:%s%s", g.gpsd_host, g.gpsd_port, VTY_NEWLINE);
 #endif
 	vty_out(vty, "gps device %s%s", g.device, VTY_NEWLINE);
 	if (g.baud)