diff options
author | jkar8572 <jkar8572> | 2005-03-17 11:14:34 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2005-03-17 11:14:34 +0000 |
commit | aed1deba584ead039d51d1fe09ccab3123304c59 (patch) | |
tree | 3c45c138b531bce0a51801df0481162f4ec92aa6 /quotaio_v2.c | |
parent | d9b0d03470bd6a47d375f664aee03a454e577951 (diff) | |
download | linuxquota-aed1deba584ead039d51d1fe09ccab3123304c59.tar.gz |
Fixed illegal reference checking in quotacheck(8) (Jan Kara)
Fix of fix of sanity check in repquota(8) (Jan Kara)
Diffstat (limited to 'quotaio_v2.c')
-rw-r--r-- | quotaio_v2.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/quotaio_v2.c b/quotaio_v2.c index 6ba7225..5176435 100644 --- a/quotaio_v2.c +++ b/quotaio_v2.c @@ -748,6 +748,12 @@ static int report_block(struct dquot *dquot, uint blk, char *bitmap, return entries; } +static void check_reference(struct quota_handle *h, uint blk) +{ + if (blk >= h->qh_info.u.v2_mdqi.dqi_blocks) + die(2, _("Illegal reference in %s quota file on %s. Quota file is probably corrupted.\nPlease run quotacheck(8) and try again.\n"), type2name(h->qh_type), h->qh_quotadev); +} + static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap, int (*process_dquot) (struct dquot *, char *)) { @@ -759,17 +765,18 @@ static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap, if (depth == V2_DQTREEDEPTH - 1) { for (i = 0; i < V2_DQBLKSIZE >> 2; i++) { blk = __le32_to_cpu(ref[i]); - if (blk >= dquot->dq_h->qh_info.u.v2_mdqi.dqi_blocks) - die(2, _("Illegal reference in %s quota file on %s. Quota file is probably corrupted.\nPlease run quotacheck(8) and try again.\n"), type2name(dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev); + check_reference(dquot->dq_h, blk); if (blk && !get_bit(bitmap, blk)) entries += report_block(dquot, blk, bitmap, process_dquot); } } else { for (i = 0; i < V2_DQBLKSIZE >> 2; i++) - if ((blk = __le32_to_cpu(ref[i]))) + if ((blk = __le32_to_cpu(ref[i]))) { + check_reference(dquot->dq_h, blk); entries += report_tree(dquot, blk, depth + 1, bitmap, process_dquot); + } } freedqbuf(buf); return entries; |