8f619f6
From 2432de0526c282f05010cfa432059cbc9e794259 Mon Sep 17 00:00:00 2001
8f619f6
From: Jan Kara <jack@suse.cz>
8f619f6
Date: Wed, 6 Jul 2016 11:10:49 +0200
8f619f6
Subject: [PATCH] quotacheck: Fix buggy error check of read(2)
8f619f6
MIME-Version: 1.0
8f619f6
Content-Type: text/plain; charset=UTF-8
8f619f6
Content-Transfer-Encoding: 8bit
8f619f6
8f619f6
'rd' was declared as size_t which is unsigned so it could never be less
8f619f6
than 0. Fix it by declaring 'rd' as ssize_t which is the real read(2)
8f619f6
return type.
8f619f6
8f619f6
Signed-off-by: Jan Kara <jack@suse.cz>
8f619f6
Signed-off-by: Petr Písař <ppisar@redhat.com>
8f619f6
---
8f619f6
 quotacheck_v2.c | 2 +-
8f619f6
 1 file changed, 1 insertion(+), 1 deletion(-)
8f619f6
8f619f6
diff --git a/quotacheck_v2.c b/quotacheck_v2.c
8f619f6
index de4293f..4cc8558 100644
8f619f6
--- a/quotacheck_v2.c
8f619f6
+++ b/quotacheck_v2.c
8f619f6
@@ -233,7 +233,7 @@ static int buffer_entry(dqbuf_t buf, uint blk, int *corrupted, uint * lblk, int
8f619f6
 
8f619f6
 static void check_read_blk(int fd, uint blk, dqbuf_t buf)
8f619f6
 {
8f619f6
-	size_t rd;
8f619f6
+	ssize_t rd;
8f619f6
 
8f619f6
 	lseek(fd, blk << QT_BLKSIZE_BITS, SEEK_SET);
8f619f6
 	rd = read(fd, buf, QT_BLKSIZE);
8f619f6
-- 
8f619f6
2.7.4
8f619f6