gpsd: Do not mess with the argv of the process

Henning got really confused that the "a.b.c:1234" he passed to
gps2udp showed up as "a.b.c 1234" in the kernel cmdline. Use
strdup to take a copy of it.

Fixes: SYS#424
This commit is contained in:
Holger Hans Peter Freyther 2014-07-15 08:28:42 +02:00
parent fd9e8b9cc4
commit 26d74189eb
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,31 @@
Index: gpsd-3.10/gps2udp.c
===================================================================
--- gpsd-3.10.orig/gps2udp.c
+++ gpsd-3.10/gps2udp.c
@@ -353,6 +353,7 @@ int main(int argc, char **argv)
bool daemonize = false;
long count = -1;
int option;
+ int i;
char *udphostport[MAX_UDP_DEST];
flags = WATCH_ENABLE;
@@ -387,7 +388,7 @@ int main(int argc, char **argv)
"gps2udp: too many UDP destinations (max=%d)\n",
MAX_UDP_DEST);
} else {
- udphostport[udpchannel++] = optarg;
+ udphostport[udpchannel++] = strdup(optarg);
}
break;
case 'v':
@@ -490,6 +491,9 @@ int main(int argc, char **argv)
} // end count
} // end len > 3
} // end for (;;)
+
+ for (i = 0; i < udpchannel; ++i)
+ free(udphostport[i]);
// This is an infinite loop, should never be here
/*@-unreachable@*/

View File

@ -6,13 +6,14 @@ DEPENDS = "ncurses python"
#DEPENDS = "ncurses libusb1 python"
PROVIDES = "virtual/gpsd"
PR = "r3.11"
PR = "r3.12"
SRC_URI = "http://download.savannah.gnu.org/releases/${PN}/${P}.tar.gz \
file://0002-SConstruct-respect-sysroot-also-in-SPLINTOPTS.patch \
file://0001-SConstruct-disable-html-and-man-docs-building-becaus.patch \
file://no-rpath-please.patch \
file://gpsd-tsip-pps.patch \
file://leave-argv-untouched.patch \
file://gpsd-default \
file://gpsd \
file://60-gpsd.rules \