summaryrefslogtreecommitdiff
path: root/shmexport.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-02-16 06:13:24 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-02-16 06:13:24 -0500
commitd607c875a0999bd29c4db7c92182c8c193379d2a (patch)
treef0013a19aa4b213cd8cc229d21c74236b5d9575e /shmexport.c
parente7e4ef68e8ee9e1f33493f0f57551dfadbbcde54 (diff)
downloadgpsd-d607c875a0999bd29c4db7c92182c8c193379d2a.tar.gz
Repair the logic for setting a non-default SHM export segment.
Also, ensure this always happens within the regression-test driver. All regression tests pass.
Diffstat (limited to 'shmexport.c')
-rw-r--r--shmexport.c6
1 files changed, 3 insertions, 3 deletions
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));