summaryrefslogtreecommitdiff
path: root/libgps_shm.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-02-09 22:51:18 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-02-09 22:51:18 -0500
commitfacc08793683c63cc658d0ae549f3561411f0a08 (patch)
treef22ff00cf1dd2f7df28c325b40b0f0783ecee463 /libgps_shm.c
parent5b4af8cc002773058ad744f9c2f9975284b09224 (diff)
downloadgpsd-facc08793683c63cc658d0ae549f3561411f0a08.tar.gz
Implement and document GPSD_SHM_KEY environment variable.
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;