Blob Blame Raw
From 2432de0526c282f05010cfa432059cbc9e794259 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 6 Jul 2016 11:10:49 +0200
Subject: [PATCH] quotacheck: Fix buggy error check of read(2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

'rd' was declared as size_t which is unsigned so it could never be less
than 0. Fix it by declaring 'rd' as ssize_t which is the real read(2)
return type.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
 quotacheck_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/quotacheck_v2.c b/quotacheck_v2.c
index de4293f..4cc8558 100644
--- a/quotacheck_v2.c
+++ b/quotacheck_v2.c
@@ -233,7 +233,7 @@ static int buffer_entry(dqbuf_t buf, uint blk, int *corrupted, uint * lblk, int
 
 static void check_read_blk(int fd, uint blk, dqbuf_t buf)
 {
-	size_t rd;
+	ssize_t rd;
 
 	lseek(fd, blk << QT_BLKSIZE_BITS, SEEK_SET);
 	rd = read(fd, buf, QT_BLKSIZE);
-- 
2.7.4