From f501f083bf1ea9f60a8b18aa9b5d59f3459ee4a6 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 23 Feb 2016 12:11:15 +0100 Subject: [PATCH] thin: fix read size compare Fix the compare with 'unsigned' sizeof() and error read -1 result. So the read error is correctly recognized. --- WHATS_NEW | 1 + lib/activate/dev_manager.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index f15d8855f..355712c6b 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.144 - ===================================== + Fir read error detection when checking for uninitialized thin-pool header. Fix error path for internal error in lvmetad vg lookup code. Version 2.02.143 - 21st February 2016 diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 2826218e0..15d6bb93c 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -1841,7 +1841,7 @@ static int _pool_callback(struct dm_tree_node *node, return 0; } /* let's assume there is no problem to read 64 bytes */ - if (read(fd, buf, sizeof(buf)) < sizeof(buf)) { + if (read(fd, buf, sizeof(buf)) < (int)sizeof(buf)) { log_sys_error("read", argv[args]); if (close(fd)) log_sys_error("close", argv[args]); -- 2.43.5