diff options
author | jkar8572 <jkar8572> | 2001-12-05 14:14:46 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2001-12-05 14:14:46 +0000 |
commit | 8a6a9af4403a6919d9d4994e51f5f4db6e694f88 (patch) | |
tree | 8ec0ed482b68ab684e62eb8bd9ddd49b104bbd11 /quotasys.c | |
parent | 9447f7d7c0928bee88dc42d48fc02c85cd4b5bf6 (diff) |
More clever handling of loopback and bind mounts. (Jan Kara);
Diffstat (limited to 'quotasys.c')
-rw-r--r-- | quotasys.c | 35 |
1 files changed, 32 insertions, 3 deletions
@@ -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 */ |