diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 01:42:45 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 01:46:53 -0400 |
commit | 4361ec2d89bdf451602d659ddfd0fb9a79c178a2 (patch) | |
tree | af067d1d7614a9e67f449eec933ba3347cde10b0 /shmexport.c | |
parent | a77b95b57475c2856707e91b197f8aaa8e5eb407 (diff) | |
download | gpsd-4361ec2d89bdf451602d659ddfd0fb9a79c178a2.tar.gz |
Change gpsd_report to no longer use a global. All regression tests pass.
This is a large, ugly change. But without it we can't troubleshoot the
ICP/IP-source initialization bug properly - colliding definitions of
gpsd_report() were interfering with error reporting early in gpsd runs.
More cleanup work remains to be done, but at least this is working.
Diffstat (limited to 'shmexport.c')
-rw-r--r-- | shmexport.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/shmexport.c b/shmexport.c index 9e213ff2..f78ba5ad 100644 --- a/shmexport.c +++ b/shmexport.c @@ -35,7 +35,8 @@ bool shm_acquire(struct gps_context_t *context) shmid = shmget((key_t)GPSD_KEY, sizeof(struct gps_data_t), (int)(IPC_CREAT|0666)); if (shmid == -1) { - gpsd_report(LOG_ERROR, "shmget(%ld, %zd, 0666) failed: %s\n", + gpsd_report(context->debug, LOG_ERROR, + "shmget(%ld, %zd, 0666) failed: %s\n", (long int)GPSD_KEY, sizeof(struct gps_data_t), strerror(errno)); @@ -43,11 +44,12 @@ bool shm_acquire(struct gps_context_t *context) } context->shmexport = (char *)shmat(shmid, 0, 0); if ((int)(long)context->shmexport == -1) { - gpsd_report(LOG_ERROR, "shmat failed: %s\n", strerror(errno)); + gpsd_report(context->debug, LOG_ERROR, "shmat failed: %s\n", strerror(errno)); context->shmexport = NULL; return false; } - gpsd_report(LOG_PROG, "shmat() succeeded, segment %d\n", shmid); + gpsd_report(context->debug, LOG_PROG, + "shmat() succeeded, segment %d\n", shmid); return true; } |