summaryrefslogtreecommitdiff
path: root/libgps_shm.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-02-11 22:37:39 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-02-11 23:31:14 -0500
commit5b3382dce406f2a520ff63b64d58f80e24ae74e2 (patch)
tree6b1ff097bb764ac394b8457b61c68ce5e6817131 /libgps_shm.c
parent80d869d92dceeab173525f80a5f973849d68433d (diff)
downloadgpsd-5b3382dce406f2a520ff63b64d58f80e24ae74e2.tar.gz
Instrument shm segment creation a bit better.
All regression tests pass.
Diffstat (limited to 'libgps_shm.c')
-rw-r--r--libgps_shm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libgps_shm.c b/libgps_shm.c
index e8dd30f4..fda963da 100644
--- a/libgps_shm.c
+++ b/libgps_shm.c
@@ -41,14 +41,16 @@ struct privdata_t
int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata)
/* open a shared-memory connection to the daemon */
{
+ int shmid;
+
/*@-nullpass@*/
- int shmid = getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY;
+ int shmkey = getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY;
/*@+nullpass@*/
libgps_debug_trace((DEBUG_CALLS, "gps_shm_open()\n"));
gpsdata->privdata = NULL;
- shmid = shmget((key_t)shmid, sizeof(struct gps_data_t), 0);
+ shmid = shmget((key_t)shmkey, sizeof(struct gps_data_t), 0);
if (shmid == -1) {
/* daemon isn't running or failed to create shared segment */
return -1;