diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2009-07-09 21:49:05 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2009-07-09 21:49:05 +0000 |
commit | 92938e4782c82af08e4ffda40af291c0dc2f1d98 (patch) | |
tree | 57f79ad767bdae73aa3709d9f52195f829c9c59c /serial.c | |
parent | d64918bc1678e2dc3e2264c7d850019949e04ca9 (diff) | |
download | gpsd-92938e4782c82af08e4ffda40af291c0dc2f1d98.tar.gz |
system call failure should be tested against -1, rather than "< 0"
Diffstat (limited to 'serial.c')
-rw-r--r-- | serial.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -69,7 +69,7 @@ speed_t gpsd_get_speed(struct termios* ttyctl) bool gpsd_set_raw(struct gps_device_t *session) { (void)cfmakeraw(&session->ttyset); - if (tcsetattr(session->gpsdata.gps_fd, TCIOFLUSH, &session->ttyset) < 0) { + if (tcsetattr(session->gpsdata.gps_fd, TCIOFLUSH, &session->ttyset) == -1) { gpsd_report(LOG_ERROR, "error changing port attributes: %s\n",strerror(errno)); return false; @@ -239,9 +239,9 @@ int gpsd_open(struct gps_device_t *session) } /*@ +boolops +type @*/ - if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, (int)(mode|O_NONBLOCK|O_NOCTTY))) < 0) { + if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, (int)(mode|O_NONBLOCK|O_NOCTTY))) == -1) { gpsd_report(LOG_ERROR, "device open failed: %s - retrying read-only\n", strerror(errno)); - if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, O_RDONLY|O_NONBLOCK|O_NOCTTY)) < 0) { + if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, O_RDONLY|O_NONBLOCK|O_NOCTTY)) == -1) { gpsd_report(LOG_ERROR, "read-only device open failed: %s\n", strerror(errno)); return -1; } |