aboutsummaryrefslogtreecommitdiff
path: root/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'mount.c')
-rw-r--r--mount.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mount.c b/mount.c
index d7b2682ce..26d4693d0 100644
--- a/mount.c
+++ b/mount.c
@@ -174,17 +174,26 @@ extern int mount_main (int argc, char **argv)
174 char *filesystemType = "auto"; 174 char *filesystemType = "auto";
175 char *device = NULL; 175 char *device = NULL;
176 char *directory = NULL; 176 char *directory = NULL;
177 struct stat statBuf;
177 int all = 0; 178 int all = 0;
178 int i; 179 int i;
179 180
181 if (stat("/etc/fstab", &statBuf) < 0)
182 fprintf(stderr, "/etc/fstab file missing -- Please install one.\n\n");
183
180 if (argc == 1) { 184 if (argc == 1) {
181 FILE *mountTable; 185 FILE *mountTable;
182 if ((mountTable = setmntent ("/proc/mounts", "r"))) { 186 if ((mountTable = setmntent ("/proc/mounts", "r"))) {
183 struct mntent *m; 187 struct mntent *m;
184 while ((m = getmntent (mountTable)) != 0) { 188 while ((m = getmntent (mountTable)) != 0) {
189 struct fstab* fstabItem;
185 char *blockDevice = m->mnt_fsname; 190 char *blockDevice = m->mnt_fsname;
186 if (strcmp (blockDevice, "/dev/root") == 0) 191 /* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
187 blockDevice = (getfsfile ("/"))->fs_spec; 192 if (strcmp (blockDevice, "/dev/root") == 0) {
193 fstabItem = getfsfile ("/");
194 if (fstabItem != NULL)
195 blockDevice = fstabItem->fs_spec;
196 }
188 printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir, 197 printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
189 m->mnt_type, m->mnt_opts); 198 m->mnt_type, m->mnt_opts);
190 } 199 }