summaryrefslogtreecommitdiff
path: root/quotasys.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2010-01-05 16:04:57 +0000
committerjkar8572 <jkar8572>2010-01-05 16:04:57 +0000
commitd271d0a329a5b3e99f4ad209b5270a8648739ff0 (patch)
treebb40ea2801530ab7865737cdb77b60335d48aa5c /quotasys.c
parent077c4c5cd183f46e89f6cb5b1269019235bb9b8a (diff)
* Rewritten configuration script to create config.h (Jan Kara)
* Use /proc/mounts for mountpoint scanning (Jan Kara) * Removed use of reserved identifiers (Jan Kara)
Diffstat (limited to 'quotasys.c')
-rw-r--r--quotasys.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/quotasys.c b/quotasys.c
index 86802c3..8df5e3b 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -5,6 +5,8 @@
* Jan Kara <jack@suse.cz> - sponsored by SuSE CR
*/
+#include "config.h"
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
@@ -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;