summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorEric Andersen1999-10-16 15:48:40 +0000
committerEric Andersen1999-10-16 15:48:40 +0000
commitcb6e25655f894c90e4befc4bee0e66794dd6858f (patch)
treee98863094266c328ffebe2920d0aead3c52cc121 /util-linux
parent3c163822d88105450806fdb6a29fdfc2511267d1 (diff)
downloadbusybox-cb6e25655f894c90e4befc4bee0e66794dd6858f.zip
busybox-cb6e25655f894c90e4befc4bee0e66794dd6858f.tar.gz
More stuff
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mount.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index d7b2682..26d4693 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -174,17 +174,26 @@ extern int mount_main (int argc, char **argv)
char *filesystemType = "auto";
char *device = NULL;
char *directory = NULL;
+ struct stat statBuf;
int all = 0;
int i;
+ if (stat("/etc/fstab", &statBuf) < 0)
+ fprintf(stderr, "/etc/fstab file missing -- Please install one.\n\n");
+
if (argc == 1) {
FILE *mountTable;
if ((mountTable = setmntent ("/proc/mounts", "r"))) {
struct mntent *m;
while ((m = getmntent (mountTable)) != 0) {
+ struct fstab* fstabItem;
char *blockDevice = m->mnt_fsname;
- if (strcmp (blockDevice, "/dev/root") == 0)
- blockDevice = (getfsfile ("/"))->fs_spec;
+ /* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
+ if (strcmp (blockDevice, "/dev/root") == 0) {
+ fstabItem = getfsfile ("/");
+ if (fstabItem != NULL)
+ blockDevice = fstabItem->fs_spec;
+ }
printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
m->mnt_type, m->mnt_opts);
}