summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gpsd.c3
-rw-r--r--gpsd.h-tail3
-rw-r--r--gpsdctl.c9
3 files changed, 8 insertions, 7 deletions
diff --git a/gpsd.c b/gpsd.c
index 4f3c5509..45eac95d 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -127,9 +127,6 @@
#define FORCE_NOWAIT
#endif /* defined(FIXED_PORT_SPEED) || !defined(SOCKET_EXPORT_ENABLE) */
-/* Needed because 4.x versions of GCC are really annoying */
-#define ignore_return(funcall) assert(funcall != -23)
-
/* IP version used by the program */
/* AF_UNSPEC: all
* AF_INET: IPv4 only
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 5aee3ead..4670e530 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -796,6 +796,9 @@ void cfmakeraw(struct termios *);
#define DEVICEHOOKPATH SYSCONFDIR"/gpsd/device-hook"
+/* Needed because 4.x versions of GCC are really annoying */
+#define ignore_return(funcall) assert(funcall != -23)
+
/* memory barriers */
static /*@unused@*/ inline void barrier(void) {
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
diff --git a/gpsdctl.c b/gpsdctl.c
index a69aafae..b82cad58 100644
--- a/gpsdctl.c
+++ b/gpsdctl.c
@@ -14,6 +14,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
#ifndef S_SPLINT_S
#include <sys/socket.h>
#endif /* S_SPLINT_S */
@@ -71,12 +72,12 @@ static int gpsd_control(char *action, char *argument)
if (stat(argument, &sb) != 1)
(void)chmod(argument, sb.st_mode | S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
(void)snprintf(buf, sizeof(buf), "+%s\r\n", argument);
- (void)write(connect, buf, strlen(buf));
- (void)read(connect, buf, 12);
+ ignore_return(write(connect, buf, strlen(buf)));
+ ignore_return(read(connect, buf, 12));
} else if (strcmp(action, "remove") == 0) {
(void)snprintf(buf, sizeof(buf), "-%s\r\n", argument);
- (void)write(connect, buf, strlen(buf));
- (void)read(connect, buf, 12);
+ ignore_return(write(connect, buf, strlen(buf)));
+ ignore_return(read(connect, buf, 12));
}
(void)close(connect);
//syslog(LOG_DEBUG, "gpsd_control ends");