summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2009-07-09 21:49:05 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2009-07-09 21:49:05 +0000
commit92938e4782c82af08e4ffda40af291c0dc2f1d98 (patch)
tree57f79ad767bdae73aa3709d9f52195f829c9c59c /serial.c
parentd64918bc1678e2dc3e2264c7d850019949e04ca9 (diff)
downloadgpsd-92938e4782c82af08e4ffda40af291c0dc2f1d98.tar.gz
system call failure should be tested against -1, rather than "< 0"
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/serial.c b/serial.c
index 6a141415..96fa95bc 100644
--- a/serial.c
+++ b/serial.c
@@ -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;
}