Fix checking a block read error

This commit is contained in:
Petr Písař 2016-11-10 14:35:07 +01:00
parent 80cb0d858b
commit 94fa093128
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,34 @@
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

View File

@ -4,7 +4,7 @@
Name: quota
Epoch: 1
Version: 4.03
Release: 6%{?dist}
Release: 7%{?dist}
Group: System Environment/Base
Summary: System administration tools for monitoring users' disk usage
# quota_nld.c, quotaio_xfs.h: GPLv2
@ -53,6 +53,9 @@ Patch6: quota-4.03-Add-support-for-scanning-using-Q_XGETNEXTQUOTA.patch
# Correct repquota indentation for file systems with hiden quota files,
# in upstream after 4.03
Patch7: quota-4.03-repquota-use-the-same-whitespace-for-quotaio_meta-as.patch
# Fix checking a block read error, in upstream after 4.03,
# <https://sourceforge.net/p/linuxquota/bugs/123/>
Patch8: quota-4.03-quotacheck-Fix-buggy-error-check-of-read-2.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bash
@ -168,6 +171,7 @@ Linux/UNIX environment.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
# Unpack forgotten LDAP scripts
tar -xzkf %{SOURCE5}
# Regenerate build scripts, also because of Respect-enviroment-CFLAGS.patch
@ -283,6 +287,9 @@ make check
%changelog
* Thu Nov 10 2016 Petr Pisar <ppisar@redhat.com> - 1:4.03-7
- Fix checking a block read error (upstream bug #123)
* Fri Jun 10 2016 Petr Pisar <ppisar@redhat.com> - 1:4.03-6
- Correct repquota indentation for file systems with hiden quota files
- Remove unnecessary quota dependency from quota-devel package