[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH] Improve test_libgps to detect gps_send() and gps_read
From: |
Robert Norris |
Subject: |
[gpsd-dev] [PATCH] Improve test_libgps to detect gps_send() and gps_read() errors. |
Date: |
Tue, 28 Jun 2016 22:53:02 +0000 |
---
test_libgps.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/test_libgps.c b/test_libgps.c
index 1102c35..c9db543 100644
--- a/test_libgps.c
+++ b/test_libgps.c
@@ -104,8 +104,16 @@ int main(int argc, char *argv[])
errno, gps_errstr(errno));
exit(EXIT_FAILURE);
} else if (forwardmode) {
- (void)gps_send(&collect, fmsg);
- (void)gps_read(&collect);
+ if (gps_send(&collect, fmsg) == -1) {
+ (void)fprintf(stderr,
+ "test_libgps: gps send error: %d, %s\n",
+ errno, gps_errstr(errno));
+ }
+ if (gps_read(&collect) == -1) {
+ (void)fprintf(stderr,
+ "test_libgps: gps read error: %d, %s\n",
+ errno, gps_errstr(errno));
+ }
#ifdef SOCKET_EXPORT_ENABLE
libgps_dump_state(&collect);
#endif
--
2.8.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gpsd-dev] [PATCH] Improve test_libgps to detect gps_send() and gps_read() errors.,
Robert Norris <=