summaryrefslogtreecommitdiff
path: root/quotasys.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-12-05 14:14:46 +0000
committerjkar8572 <jkar8572>2001-12-05 14:14:46 +0000
commit8a6a9af4403a6919d9d4994e51f5f4db6e694f88 (patch)
tree8ec0ed482b68ab684e62eb8bd9ddd49b104bbd11 /quotasys.c
parent9447f7d7c0928bee88dc42d48fc02c85cd4b5bf6 (diff)
More clever handling of loopback and bind mounts. (Jan Kara);
Diffstat (limited to 'quotasys.c')
-rw-r--r--quotasys.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/quotasys.c b/quotasys.c
index 9f0ccd2..a482bd6 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -657,9 +657,38 @@ static int cache_mnt_table(void)
free((char *)devname);
continue;
}
- if (!S_ISBLK(st.st_mode) && !S_ISCHR(st.st_mode))
- errstr(_("Warning: Device %s is not block nor character device.\n"), devname);
- dev = st.st_rdev;
+ if (!S_ISBLK(st.st_mode) && !S_ISCHR(st.st_mode)) { /* Some 'bind' or 'loop' mount? */
+ char *opt;
+
+ if (hasmntopt(mnt, MNTOPT_BIND))
+ dev = st.st_dev;
+ else if ((opt = hasmntopt(mnt, MNTOPT_LOOP))) {
+ if (!(opt = strchr(opt, '='))) {
+ errstr(_("Can't find device of loopback mount in options for %s. Skipping.\n"), devname);
+ free((char *)devname);
+ continue;
+ }
+ opt++;
+ if (stat(opt, &st) < 0) { /* Can't stat loopback device? */
+ errstr(_("Can't stat() loopback device %s: %s\n"), opt, strerror(errno));
+ free((char *)devname);
+ continue;
+ }
+ if (!S_ISBLK(st.st_mode)) {
+ errstr(_("Loopback device %s isn't block device!\n"), opt);
+ free((char *)devname);
+ continue;
+ }
+ dev = st.st_rdev;
+ }
+ else {
+ errstr(_("Device (%s) filesystem is mounted on isn't block or character device nor it's loopback or bind mount. Skipping.\n"), devname);
+ free((char *)devname);
+ continue;
+ }
+ }
+ else
+ dev = st.st_rdev;
for (i = 0; i < mnt_entries_cnt && mnt_entries[i].me_dev != dev; i++);
}
/* Cope with network filesystems or new mountpoint */