summaryrefslogtreecommitdiff
path: root/libgps_shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgps_shm.c')
-rw-r--r--libgps_shm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libgps_shm.c b/libgps_shm.c
index c489af09..5d37f628 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -41,12 +41,12 @@ struct privdata_t
int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata)
/* open a shared-memory connection to the daemon */
{
- int shmid;
+ int shmid = getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY;
libgps_debug_trace((DEBUG_CALLS, "gps_shm_open()\n"));
gpsdata->privdata = NULL;
- shmid = shmget((key_t)GPSD_KEY, sizeof(struct gps_data_t), 0);
+ shmid = shmget((key_t)shmid, sizeof(struct gps_data_t), 0);
if (shmid == -1) {
/* daemon isn't running or failed to create shared segment */
return -1;