From d271d0a329a5b3e99f4ad209b5270a8648739ff0 Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Tue, 5 Jan 2010 16:04:57 +0000 Subject: * Rewritten configuration script to create config.h (Jan Kara) * Use /proc/mounts for mountpoint scanning (Jan Kara) * Removed use of reserved identifiers (Jan Kara) --- quotasys.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'quotasys.c') diff --git a/quotasys.c b/quotasys.c index 86802c3..8df5e3b 100644 --- a/quotasys.c +++ b/quotasys.c @@ -5,6 +5,8 @@ * Jan Kara - sponsored by SuSE CR */ +#include "config.h" + #include #include #include @@ -913,17 +915,20 @@ static int cache_mnt_table(int flags) int autofsdircnt = 0; char autofsdir[AUTOFS_DIR_MAX][PATH_MAX]; - if (!(mntf = setmntent(_PATH_MOUNTED, "r"))) { - if (errno != ENOENT) { - errstr(_("Cannot open %s: %s\n"), _PATH_MOUNTED, strerror(errno)); - return -1; - } - else /* Fallback on fstab when mtab not available */ - if (!(mntf = setmntent(_PATH_MNTTAB, "r"))) { - errstr(_("Cannot open %s: %s\n"), _PATH_MNTTAB, strerror(errno)); - return -1; - } +#ifdef ALT_MTAB + mntf = setmntent(ALT_MTAB, "r"); + if (mntf) + goto alloc; +#endif + mntf = setmntent(_PATH_MOUNTED, "r"); + if (mntf) + goto alloc; + /* Fallback to fstab when mtab not available */ + if (!(mntf = setmntent(_PATH_MNTTAB, "r"))) { + errstr(_("Cannot open any file with mount points.\n")); + return -1; } +alloc: mnt_entries = smalloc(sizeof(struct mount_entry) * ALLOC_ENTRIES_NUM); mnt_entries_cnt = 0; allocated += ALLOC_ENTRIES_NUM; -- cgit v1.2.3