summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct9
-rw-r--r--gpsctl.c2
-rw-r--r--gpsd.h-tail2
-rw-r--r--libgps_shm.c2
-rwxr-xr-xregress-driver5
-rw-r--r--shmexport.c6
6 files changed, 13 insertions, 13 deletions
diff --git a/SConstruct b/SConstruct
index 80e9f489..604f8edd 100644
--- a/SConstruct
+++ b/SConstruct
@@ -279,11 +279,6 @@ for key, value in os.environ.iteritems():
# $SRCDIR replaces occurrences for $(srcdir) in the autotools build.
env['SRCDIR'] = '.'
-# In the test productions, use a non-default value of the SHM key
-# to avoid colliding with production instances. Value must be legal for
-# atoi(3)/strtoul(3); this is the default key plus one.
-env["GPSD_SHM_KEY"] = "0x47505345"
-
# We may need to force slow regression tests to get around race
# conditions in the pty layer, especially on a loaded machine.
if env["slow"]:
@@ -1576,7 +1571,7 @@ else:
# SCons to install up to date versions of gpsfake and gpsctl if it can
# find older versions of them in a directory on your $PATH.
gps_regress = Utility("gps-regress", [gpsd, gpsctl, python_built_extensions],
- ':; $SRCDIR/gpsfake -T; $SRCDIR/gpsctl -R 2>/dev/null; $SRCDIR/regress-driver $REGRESSOPTS test/daemon/*.log')
+ ':; $SRCDIR/gpsfake -T; $SRCDIR/regress-driver $REGRESSOPTS test/daemon/*.log')
# Build the regression tests for the daemon.
# Note: You'll have to do this whenever the default leap second
@@ -1584,7 +1579,7 @@ else:
# that driver relies on the default until it gets the current
# offset from subframe data.
Utility('gps-makeregress', [gpsd, gpsctl, python_built_extensions],
- ':; $SRCDIR/gpsctl -R 2>/dev/null; $SRCDIR/gpsfake -T; $SRCDIR/regress-driver -b $REGRESSOPTS test/daemon/*.log')
+ ':; $SRCDIR/gpsfake -T; $SRCDIR/regress-driver -b $REGRESSOPTS test/daemon/*.log')
# To build an individual test for a load named foo.log, put it in
# test/daemon and do this:
diff --git a/gpsctl.c b/gpsctl.c
index b0d78c34..5dbf2069 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
case 'R': /* remove the SHM export segment */
#ifdef SHM_EXPORT_ENABLE
/*@-nullpass@*/
- status = shmget(getenv("GPSD_SHM_KEY") ? (key_t)atoi(getenv("GPSD_SHM_KEY")) : (key_t)GPSD_KEY, 0, 0);
+ status = shmget(getenv("GPSD_SHM_KEY") ? (key_t)strtol(getenv("GPSD_SHM_KEY"), NULL, 0) : (key_t)GPSD_SHM_KEY, 0, 0);
if (status == -1) {
gpsd_report(&context.errout, LOG_WARN,
"GPSD SHM segment does not exist.\n");
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 99624789..bf4ec919 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -979,7 +979,7 @@ extern void ecef_to_wgs84fix(/*@out@*/struct gps_fix_t *,
extern void clear_dop(/*@out@*/struct dop_t *);
/* shmexport.c */
-#define GPSD_KEY 0x47505344 /* "GPSD" */
+#define GPSD_SHM_KEY 0x47505344 /* "GPSD" */
struct shmexport_t
{
int bookend1;
diff --git a/libgps_shm.c b/libgps_shm.c
index fda963da..9cb23e19 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -44,7 +44,7 @@ int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata)
int shmid;
/*@-nullpass@*/
- int shmkey = getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY;
+ long shmkey = getenv("GPSD_SHM_KEY") ? strtol(getenv("GPSD_SHM_KEY"), NULL, 0) : GPSD_SHM_KEY;
/*@+nullpass@*/
libgps_debug_trace((DEBUG_CALLS, "gps_shm_open()\n"));
diff --git a/regress-driver b/regress-driver
index 86ab10b4..f6f3c96a 100755
--- a/regress-driver
+++ b/regress-driver
@@ -38,6 +38,11 @@ if [ -d ${py_libdir} ] && [ -d ${py_scriptdir} ]; then
fi
export GPSD_HOME PATH
+# Use a non-default value of the SHM key to avoid colliding with
+# production instances. Value must be legal for strtol(3);
+# this is the default key plus one.
+export GPSD_SHM_KEY=0x47505345
+
mode=regress
testing=daemon
opts=""
diff --git a/shmexport.c b/shmexport.c
index 229ad697..3b2f6d8f 100644
--- a/shmexport.c
+++ b/shmexport.c
@@ -35,20 +35,20 @@ bool shm_acquire(struct gps_context_t *context)
/* initialize the shared-memory segment to be used for export */
{
/*@-nullpass@*/
- int shmkey = getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY;
+ long shmkey = getenv("GPSD_SHM_KEY") ? strtol(getenv("GPSD_SHM_KEY"), NULL, 0) : GPSD_SHM_KEY;
/*@+nullpass@*/
int shmid = shmget((key_t)shmkey, sizeof(struct gps_data_t), (int)(IPC_CREAT|0666));
if (shmid == -1) {
gpsd_report(&context->errout, LOG_ERROR,
- "shmget(%x, %zd, 0666) for SHM export failed: %s\n",
+ "shmget(0x%lx, %zd, 0666) for SHM export failed: %s\n",
shmkey,
sizeof(struct gps_data_t),
strerror(errno));
return false;
} else
gpsd_report(&context->errout, LOG_PROG,
- "shmget(%x, %zd, 0666) for SHM export succeeded\n",
+ "shmget(0x%lx, %zd, 0666) for SHM export succeeded\n",
shmkey,
sizeof(struct gps_data_t));