X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fserial.c;h=8bbd94c05534db9c16abdeeafef06b04292b8ac1;hp=fda878706621a83ea5d7bee1cca77908a8884deb;hb=d486225f89ea52d8ed2b4242eba2ad94c409f837;hpb=196f5bd17880d91ba0da33a8f5f6168d039cfa0c diff --git a/src/serial.c b/src/serial.c index fda87870..8bbd94c0 100644 --- a/src/serial.c +++ b/src/serial.c @@ -52,15 +52,15 @@ static int serial_read(void) { /* there are a variety of names for the serial device */ if ((fh = fopen("/proc/tty/driver/serial", "r")) == NULL && (fh = fopen("/proc/tty/driver/ttyS", "r")) == NULL) { - char errbuf[1024]; - WARNING("serial: fopen: %s", sstrerror(errno, errbuf, sizeof(errbuf))); + WARNING("serial: fopen: %s", STRERRNO); return -1; } while (fgets(buffer, sizeof(buffer), fh) != NULL) { derive_t rx = 0; derive_t tx = 0; - _Bool have_rx = 0, have_tx = 0; + bool have_rx = false; + bool have_tx = false; size_t len; char *fields[16]; @@ -88,10 +88,10 @@ static int serial_read(void) { if (strncmp(fields[i], "tx:", 3) == 0) { if (strtoderive(fields[i] + 3, &tx) == 0) - have_tx = 1; + have_tx = true; } else if (strncmp(fields[i], "rx:", 3) == 0) { if (strtoderive(fields[i] + 3, &rx) == 0) - have_rx = 1; + have_rx = true; } }