aboutsummaryrefslogtreecommitdiff
path: root/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'mount.c')
-rw-r--r--mount.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/mount.c b/mount.c
index ee6c9475a..76f048b1c 100644
--- a/mount.c
+++ b/mount.c
@@ -154,8 +154,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
154 } 154 }
155 } 155 }
156#endif 156#endif
157 status = 157 status = mount(specialfile, dir, filesystemtype, flags, string_flags);
158 mount(specialfile, dir, filesystemtype, flags, string_flags);
159 } 158 }
160 159
161 160
@@ -176,6 +175,11 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
176 del_loop(specialfile); 175 del_loop(specialfile);
177 } 176 }
178#endif 177#endif
178
179 if (errno == EPERM) {
180 fatalError("mount: permission denied. Are you root?\n");
181 }
182
179 return (FALSE); 183 return (FALSE);
180} 184}
181 185
@@ -307,7 +311,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
307 fakeIt, mtab_opts); 311 fakeIt, mtab_opts);
308 } 312 }
309 313
310 if (status == FALSE && whineOnErrors == TRUE) { 314 if (status == FALSE) {
311 if (whineOnErrors == TRUE) { 315 if (whineOnErrors == TRUE) {
312 fprintf(stderr, "Mounting %s on %s failed: %s\n", 316 fprintf(stderr, "Mounting %s on %s failed: %s\n",
313 blockDevice, directory, strerror(errno)); 317 blockDevice, directory, strerror(errno));
@@ -458,24 +462,19 @@ extern int mount_main(int argc, char **argv)
458 // If the filesystem isn't noauto, 462 // If the filesystem isn't noauto,
459 // and isn't swap or nfs, then mount it 463 // and isn't swap or nfs, then mount it
460 if ((!strstr(m->mnt_opts, "noauto")) && 464 if ((!strstr(m->mnt_opts, "noauto")) &&
461 (!strstr(m->mnt_type, "swap")) && 465 (!strstr(m->mnt_type, "swap")) &&
462 (!strstr(m->mnt_type, "nfs"))) { 466 (!strstr(m->mnt_type, "nfs"))) {
463 flags = 0; 467 flags = 0;
464 *string_flags = '\0'; 468 *string_flags = '\0';
465 parse_mount_options(m->mnt_opts, &flags, string_flags); 469 parse_mount_options(m->mnt_opts, &flags, string_flags);
466 /* If the directory is /, try to remount
467 * with the options specified in fstab */
468 if (m->mnt_dir[0] == '/' && m->mnt_dir[1] == '\0') {
469 flags |= MS_REMOUNT;
470 }
471 if (mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, 470 if (mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type,
472 flags, string_flags, useMtab, fakeIt, 471 flags, string_flags, useMtab, fakeIt,
473 extra_opts, FALSE)) 472 extra_opts, FALSE)==FALSE)
474 { 473 {
475 /* Try again, but this time try a remount */ 474 /* Try again, but this time try a remount */
476 mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, 475 mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type,
477 flags|MS_REMOUNT, string_flags, useMtab, fakeIt, 476 flags|MS_REMOUNT, string_flags, useMtab, fakeIt,
478 extra_opts, TRUE); 477 extra_opts, TRUE);
479 } 478 }
480 } 479 }
481 } 480 }