]> git.itanic.dy.fi Git - glucose/commitdiff
Do not return error if no more entries are read
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 23 Jul 2012 15:01:28 +0000 (18:01 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 23 Jul 2012 15:01:28 +0000 (18:01 +0300)
Since commit 009c9b76361 the tool was always returning an error
condition when the last entry was read from the meter. This is not
correct as reading the last entry is not an error condition.

Unfortunately it is not know how to detect the lack of entries from
the device from the last read entry. Therefore, in case we fail to
read proper data from the device, we will always assume we were able
to read all entries.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
main.c

diff --git a/main.c b/main.c
index 449fa157873fe3aed9e0856854a5661d650f3db1..f0faa447d5bf6b8d0fd96c77387e667b36cffd5f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -117,7 +117,7 @@ static int dump_entries(struct user_options *opts, int fd, int usage_code)
        while (1) {
                ret = contour_read_entry(fd, usage_code, &msg);
                if (ret < 45)
        while (1) {
                ret = contour_read_entry(fd, usage_code, &msg);
                if (ret < 45)
-                       return -1;
+                       break;
 
                ret = format_message(opts, &msg, ret);
                if (ret < 0)
 
                ret = format_message(opts, &msg, ret);
                if (ret < 0)