summaryrefslogtreecommitdiff
path: root/quotasys.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-09-04 16:21:58 +0000
committerjkar8572 <jkar8572>2001-09-04 16:21:58 +0000
commitc0144017620cbee64a818ede2ea7d23d04aaff56 (patch)
treeaf0a2b7a4da253dca12865dd74f114a3b21ba885 /quotasys.c
parent5cf36f5e002247effba3cf51a77e1d3f23c35a7b (diff)
quotacheck(8) now creates backup quotafiles only when -b specified (Preston Brown)
Fixed bug in parsing of passed mountpoints (reported by Preston Brown) More verbose output of quotaon (Preston Brown) quotacheck(8) now automatically chooses vfsv0 quota format when no quota files are found and special filenames are not specified.
Diffstat (limited to 'quotasys.c')
-rw-r--r--quotasys.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/quotasys.c b/quotasys.c
index 21d3a72..f25a80a 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -657,27 +657,40 @@ static int process_dirs(int dcnt, char **dirs)
check_dirs = smalloc(sizeof(struct searched_dir) * dcnt);
for (i = 0; i < dcnt; i++) {
if (stat(dirs[i], &st) < 0) {
- errstr(_("Can't stat() given mountpoint %s: %s\n"), dirs[i], strerror(errno));
+ errstr(_("Can't stat() given mountpoint %s: %s\nSkipping...\n"), dirs[i], strerror(errno));
continue;
}
check_dirs[check_dirs_cnt].sd_dir = S_ISDIR(st.st_mode);
if (S_ISDIR(st.st_mode)) {
check_dirs[check_dirs_cnt].sd_dev = st.st_dev;
check_dirs[check_dirs_cnt].sd_ino = st.st_ino;
+ if (!realpath(dirs[i], mntpointbuf)) {
+ errstr(_("Can't resolve path %s: %s\n"), dirs[i], strerror(errno));
+ continue;
+ }
}
- else if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))
+ else if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) {
+ int mentry;
+
check_dirs[check_dirs_cnt].sd_dev = st.st_rdev;
+ for (mentry = 0; mentry < mnt_entries_cnt && mnt_entries[mentry].me_dev != st.st_rdev; mentry++);
+ if (mentry == mnt_entries_cnt) {
+ errstr(_("Can't find mountpoint for device %s\n"), dirs[i]);
+ continue;
+ }
+ strcpy(mntpointbuf, mnt_entries[mentry].me_dir);
+ }
else {
errstr(_("Specified path %s is not directory nor device.\n"), dirs[i]);
continue;
}
- if (!realpath(dirs[i], mntpointbuf)) {
- errstr(_("Can't resolve path %s: %s\n"), dirs[i], strerror(errno));
- continue;
- }
check_dirs[check_dirs_cnt].sd_name = sstrdup(mntpointbuf);
check_dirs_cnt++;
}
+ if (!check_dirs_cnt) {
+ errstr(_("No correct mountpoint specified.\n"));
+ return -1;
+ }
}
return 0;
}