From e1200421607be898a9c56618948c3f5e4e00781e Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Mon, 24 May 2004 19:39:15 +0000 Subject: Updated version to 3.12 Fixed a few memleaks Added two manpages Fixed problem with all-zero root structure --- quotaio_v2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'quotaio_v2.c') diff --git a/quotaio_v2.c b/quotaio_v2.c index 095c39c..47e0cdc 100644 --- a/quotaio_v2.c +++ b/quotaio_v2.c @@ -662,6 +662,11 @@ static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id) strerror(errno)); } v2_disk2memdqblk(&dquot->dq_dqb, &ddquot); + /* Unescape all-zero structure (it can be on disk after a crash) */ + if (!dquot->dq_id && !dquot->dq_dqb.dqb_bhardlimit && !dquot->dq_dqb.dqb_bsoftlimit && + !dquot->dq_dqb.dqb_curspace && !dquot->dq_dqb.dqb_ihardlimit && !dquot->dq_dqb.dqb_isoftlimit && + !dquot->dq_dqb.dqb_curinodes && !dquot->dq_dqb.dqb_btime && dquot->dq_dqb.dqb_itime == 1) + dquot->dq_dqb.dqb_itime = 0; } return dquot; } @@ -791,8 +796,10 @@ static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct d die(4, _("Can't sync quotas on device %s: %s\n"), h->qh_quotadev, strerror(errno)); lseek(h->qh_fd, V2_DQINFOOFF, SEEK_SET); - if (read(h->qh_fd, &ddqinfo, sizeof(ddqinfo)) != sizeof(ddqinfo)) + if (read(h->qh_fd, &ddqinfo, sizeof(ddqinfo)) != sizeof(ddqinfo)) { + free(dquot); return -1; + } info->dqi_blocks = __le32_to_cpu(ddqinfo.dqi_blocks); dquot->dq_h = h; bitmap = smalloc((info->dqi_blocks + 7) >> 3); -- cgit v1.2.3