X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmultimeter.c;h=03608e6cfe5e61110e13552f43f7fd8e5963c46c;hb=b8913bc047474aa0a3bfbf03ecbb3b5050605ed1;hp=775eb57e27bff64201f81e83cf6528c36fa0608e;hpb=56159e13f4b983a2e8c846b39ca96b2384ec746a;p=collectd.git diff --git a/src/multimeter.c b/src/multimeter.c index 775eb57e..03608e6c 100644 --- a/src/multimeter.c +++ b/src/multimeter.c @@ -153,9 +153,9 @@ static int multimeter_init (void) for (i = 0; i < 10; i++) { - device[strlen(device)-1] = i + '0'; + device[strlen(device)-1] = i + '0'; - if ((fd = open(device, O_RDWR | O_NOCTTY)) > 0) + if ((fd = open(device, O_RDWR | O_NOCTTY)) != -1) { struct termios tios; int rts = TIOCM_RTS; @@ -171,7 +171,7 @@ static int multimeter_init (void) tcflush(fd, TCIFLUSH); tcsetattr(fd, TCSANOW, &tios); ioctl(fd, TIOCMBIC, &rts); - + if (multimeter_read_value (&value) < -1) { close (fd);