[prev in list] [next in list] [prev in thread] [next in thread]
List: gpsd-dev
Subject: [Gpsd-dev] Patch for compilation problems with RTCM104_SERVICE defined
From: vnuorval () tcs ! hut ! fi (Ville Nuorvala)
Date: 2006-04-18 12:08:18
Message-ID: 4444D6B2.5040805 () tcs ! hut ! fi
[Download RAW message or body]
Hi,
I know the RTCM104_SERVICE stuff is just a stub at the moment, but there
are still a couple of obvious bugs in it:
A reference to the nonexistent struct subscriber_t rtcm field causes the
compilation to fail.
The wrong socket is used after the accept() call.
The attached patch fixes both problems.
Regards,
Ville
["RTCM104_SERVICE.patch" (text/x-patch)]
Index: gpsd.c
===================================================================
--- gpsd.c (revision 3278)
+++ gpsd.c (working copy)
@@ -1066,7 +1066,7 @@
static char *gpsd_service = NULL;
#ifdef RTCM104_SERVICE
static char *rtcm_service = NULL;
- static int nsock, rsock = -1;
+ static int nsock;
#endif /* RTCM104_SERVICE */
static char *control_socket = NULL;
struct gps_device_t *device, *channel;
@@ -1340,18 +1340,18 @@
socklen_t alen = (socklen_t)sizeof(fsin);
/*@i1@*/int ssock = accept(nsock, (struct sockaddr *)&fsin, &alen);
- if (rsock < 0)
+ if (ssock < 0)
gpsd_report(0, "accept: %s\n", strerror(errno));
else {
- int opts = fcntl(rsock, F_GETFL);
+ int opts = fcntl(ssock, F_GETFL);
if (opts >= 0)
- (void)fcntl(rsock, F_SETFL, opts | O_NONBLOCK);
- gpsd_report(3, "client connect on %d\n", rsock);
+ (void)fcntl(ssock, F_SETFL, opts | O_NONBLOCK);
+ gpsd_report(3, "client connect on %d\n", ssock);
FD_SET(ssock, &all_fds);
- subscribers[rsock].active = true;
- subscribers[rsock].tied = false;
- subscribers[rsock].requires = RTCM104;
+ subscribers[ssock].active = true;
+ subscribers[ssock].tied = false;
+ subscribers[ssock].requires = RTCM104;
}
FD_CLR(nsock, &rfds);
}
@@ -1486,7 +1486,8 @@
gpsd_report(1, "<= client(%d): %s", cfd, buf);
#ifdef RTCM104_SERVICE
- if (subscribers[cfd].rtcm) {
+ if (subscribers[cfd].requires==RTCM104
+ || subscribers[cfd].requires==ANY) {
if (handle_dgpsip_request(cfd, buf, buflen) < 0)
detach_client(cfd);
} else
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic