X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fted.c;h=282212b114f0c1832a4401663825aebf0678715c;hb=aa3811995bfae69f0d1a0f897acfa4a9a4c0138a;hp=186cf2b4bb1399b32fcfcbf3f585fe3b6539a715;hpb=b599cc64d3ba270fb9fb7116631a01b7404f1a9b;p=collectd.git diff --git a/src/ted.c b/src/ted.c index 186cf2b4..282212b1 100644 --- a/src/ted.c +++ b/src/ted.c @@ -74,7 +74,11 @@ static int ted_read_value(double *ret_power, double *ret_voltage) int package_buffer_pos; fd_set input; - struct timeval timeout; + + /* Initialize timeout structure, set to 2 seconds */ + struct timeval timeout = { + .tv_sec = 2 + }; int end_flag; int escape_flag; @@ -87,11 +91,6 @@ static int ted_read_value(double *ret_power, double *ret_voltage) FD_ZERO (&input); FD_SET (fd, &input); - /* Initialize timeout structure, set to 2 seconds */ - memset (&timeout, 0, sizeof (timeout)); - timeout.tv_sec = 2; - timeout.tv_usec = 0; - /* clear out anything in the buffer */ tcflush (fd, TCIFLUSH);