diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2013-06-18 21:58:13 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2013-06-18 22:12:51 +0200 |
commit | 155841c349c58e2332802d85f3c39b8933cdd761 (patch) | |
tree | 63b450bf768375070ca1a58d7b9ca6947b771d2d /libdaemon | |
parent | e3d39217794731402cedddb9cbaebf75c08c97ba (diff) | |
download | lvm2-155841c349c58e2332802d85f3c39b8933cdd761.tar.gz |
lvmetad: fix compare function
Check for enough space in preallocated buffer.
Fixes problem, when lvm code started to suddenly allocate
too big memory chunks.
TODO: lvmetad protocol should announce needed size ahead,
so if metadata have 1MB we are not reallocating memory...
Diffstat (limited to 'libdaemon')
-rw-r--r-- | libdaemon/client/daemon-io.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libdaemon/client/daemon-io.c b/libdaemon/client/daemon-io.c index 37f274479..6ede8a827 100644 --- a/libdaemon/client/daemon-io.c +++ b/libdaemon/client/daemon-io.c @@ -41,7 +41,7 @@ int buffer_read(int fd, struct buffer *buffer) { buffer->used -= 4; break; /* success, we have the full message now */ } - if (buffer->used - buffer->allocated < 32) + if (buffer->allocated - buffer->used < 32) if (!buffer_realloc(buffer, 1024)) goto fail; continue; |