diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-25 02:35:20 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-25 02:35:20 +0200 |
commit | 6d9d9d950e84f010ed5f4cd8c77e92e8eb563c0d (patch) | |
tree | a38a50aec8e322d455c208f20c30f4ea2f59564c | |
parent | libmdsclient: libmds_compose_v is not a candidate for gnu_printf (diff) | |
download | mds-6d9d9d950e84f010ed5f4cd8c77e92e8eb563c0d.tar.gz mds-6d9d9d950e84f010ed5f4cd8c77e92e8eb563c0d.tar.bz2 mds-6d9d9d950e84f010ed5f4cd8c77e92e8eb563c0d.tar.xz |
fix m bug
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/libmdsclient/proto-util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libmdsclient/proto-util.c b/src/libmdsclient/proto-util.c index 6ab2a9c..b4c580e 100644 --- a/src/libmdsclient/proto-util.c +++ b/src/libmdsclient/proto-util.c @@ -770,11 +770,12 @@ int libmds_next_message_id(uint32_t* restrict message_id, int (*test)(uint32_t message_id, void* data), void* data) { uint32_t id = *message_id; + uint32_t first_test; int r; id = id == UINT32_MAX ? 0 : (id + 1); if (test != NULL) - for (;;) + for (first_test = id;;) { r = test(id, data); if (r < 0) @@ -782,7 +783,7 @@ int libmds_next_message_id(uint32_t* restrict message_id, if (r) break; id = id == UINT32_MAX ? 0 : (id + 1); - if (id == *message_id) + if (id == first_test) return errno = EAGAIN, -1; } |