summaryrefslogtreecommitdiff
path: root/quotaio_v2.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2004-05-24 19:39:15 +0000
committerjkar8572 <jkar8572>2004-05-24 19:39:15 +0000
commite1200421607be898a9c56618948c3f5e4e00781e (patch)
tree0d5c6787f879b8cd79c324683bdde037d26ac2b5 /quotaio_v2.c
parent06ac151a68c668a8c4cee8a2a377b0ae93b99fb1 (diff)
Updated version to 3.12
Fixed a few memleaks Added two manpages Fixed problem with all-zero root structure
Diffstat (limited to 'quotaio_v2.c')
-rw-r--r--quotaio_v2.c9
1 files changed, 8 insertions, 1 deletions
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);