diff options
author | Matt Kraai <kraai@debian.org> | 2001-06-03 02:21:38 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-06-03 02:21:38 +0000 |
commit | 9344f7575e5ebba3a0af479b30e7e304224fa345 (patch) | |
tree | 7b8fa22fabdfb313341f28f5f3e7ee8af325fe2a | |
parent | 8b113f93b9b9157ea1e013667eaaf00aed97a251 (diff) | |
download | busybox-w32-9344f7575e5ebba3a0af479b30e7e304224fa345.tar.gz busybox-w32-9344f7575e5ebba3a0af479b30e7e304224fa345.tar.bz2 busybox-w32-9344f7575e5ebba3a0af479b30e7e304224fa345.zip |
Don't whine about already mounted filesystems when invoked with -a.
-rw-r--r-- | mount.c | 15 | ||||
-rw-r--r-- | util-linux/mount.c | 15 |
2 files changed, 18 insertions, 12 deletions
@@ -120,7 +120,7 @@ static const struct mount_options mount_options[] = { | |||
120 | static int | 120 | static int |
121 | do_mount(char *specialfile, char *dir, char *filesystemtype, | 121 | do_mount(char *specialfile, char *dir, char *filesystemtype, |
122 | long flags, void *string_flags, int useMtab, int fakeIt, | 122 | long flags, void *string_flags, int useMtab, int fakeIt, |
123 | char *mtab_opts) | 123 | char *mtab_opts, int mount_all) |
124 | { | 124 | { |
125 | int status = 0; | 125 | int status = 0; |
126 | #if defined BB_FEATURE_MOUNT_LOOP | 126 | #if defined BB_FEATURE_MOUNT_LOOP |
@@ -149,10 +149,13 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
149 | } | 149 | } |
150 | #endif | 150 | #endif |
151 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); | 151 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
152 | if (errno == EROFS) { | 152 | if (status < 0 && errno == EROFS) { |
153 | error_msg("%s is write-protected, mounting read-only", specialfile); | 153 | error_msg("%s is write-protected, mounting read-only", specialfile); |
154 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); | 154 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); |
155 | } | 155 | } |
156 | /* Don't whine about already mounted filesystems when mounting all. */ | ||
157 | if (status < 0 && errno == EBUSY && mount_all) | ||
158 | return TRUE; | ||
156 | } | 159 | } |
157 | 160 | ||
158 | 161 | ||
@@ -233,7 +236,7 @@ parse_mount_options(char *options, int *flags, char *strflags) | |||
233 | extern int | 236 | extern int |
234 | mount_one(char *blockDevice, char *directory, char *filesystemType, | 237 | mount_one(char *blockDevice, char *directory, char *filesystemType, |
235 | unsigned long flags, char *string_flags, int useMtab, int fakeIt, | 238 | unsigned long flags, char *string_flags, int useMtab, int fakeIt, |
236 | char *mtab_opts, int whineOnErrors) | 239 | char *mtab_opts, int whineOnErrors, int mount_all) |
237 | { | 240 | { |
238 | int status = 0; | 241 | int status = 0; |
239 | 242 | ||
@@ -256,7 +259,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
256 | if (!*noauto_fstype) { | 259 | if (!*noauto_fstype) { |
257 | status = do_mount(blockDevice, directory, filesystemType, | 260 | status = do_mount(blockDevice, directory, filesystemType, |
258 | flags | MS_MGC_VAL, string_flags, | 261 | flags | MS_MGC_VAL, string_flags, |
259 | useMtab, fakeIt, mtab_opts); | 262 | useMtab, fakeIt, mtab_opts, mount_all); |
260 | if (status == TRUE) | 263 | if (status == TRUE) |
261 | break; | 264 | break; |
262 | } | 265 | } |
@@ -264,7 +267,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
264 | } else { | 267 | } else { |
265 | status = do_mount(blockDevice, directory, filesystemType, | 268 | status = do_mount(blockDevice, directory, filesystemType, |
266 | flags | MS_MGC_VAL, string_flags, useMtab, | 269 | flags | MS_MGC_VAL, string_flags, useMtab, |
267 | fakeIt, mtab_opts); | 270 | fakeIt, mtab_opts, mount_all); |
268 | } | 271 | } |
269 | 272 | ||
270 | if (status == FALSE) { | 273 | if (status == FALSE) { |
@@ -450,7 +453,7 @@ singlemount: | |||
450 | } | 453 | } |
451 | #endif | 454 | #endif |
452 | if (!mount_one(device, directory, filesystemType, flags, | 455 | if (!mount_one(device, directory, filesystemType, flags, |
453 | string_flags, useMtab, fakeIt, extra_opts, TRUE)) | 456 | string_flags, useMtab, fakeIt, extra_opts, TRUE, all)) |
454 | rc = EXIT_FAILURE; | 457 | rc = EXIT_FAILURE; |
455 | 458 | ||
456 | if (all == FALSE) | 459 | if (all == FALSE) |
diff --git a/util-linux/mount.c b/util-linux/mount.c index e40d75f79..17517fe21 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -120,7 +120,7 @@ static const struct mount_options mount_options[] = { | |||
120 | static int | 120 | static int |
121 | do_mount(char *specialfile, char *dir, char *filesystemtype, | 121 | do_mount(char *specialfile, char *dir, char *filesystemtype, |
122 | long flags, void *string_flags, int useMtab, int fakeIt, | 122 | long flags, void *string_flags, int useMtab, int fakeIt, |
123 | char *mtab_opts) | 123 | char *mtab_opts, int mount_all) |
124 | { | 124 | { |
125 | int status = 0; | 125 | int status = 0; |
126 | #if defined BB_FEATURE_MOUNT_LOOP | 126 | #if defined BB_FEATURE_MOUNT_LOOP |
@@ -149,10 +149,13 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
149 | } | 149 | } |
150 | #endif | 150 | #endif |
151 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); | 151 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
152 | if (errno == EROFS) { | 152 | if (status < 0 && errno == EROFS) { |
153 | error_msg("%s is write-protected, mounting read-only", specialfile); | 153 | error_msg("%s is write-protected, mounting read-only", specialfile); |
154 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); | 154 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); |
155 | } | 155 | } |
156 | /* Don't whine about already mounted filesystems when mounting all. */ | ||
157 | if (status < 0 && errno == EBUSY && mount_all) | ||
158 | return TRUE; | ||
156 | } | 159 | } |
157 | 160 | ||
158 | 161 | ||
@@ -233,7 +236,7 @@ parse_mount_options(char *options, int *flags, char *strflags) | |||
233 | extern int | 236 | extern int |
234 | mount_one(char *blockDevice, char *directory, char *filesystemType, | 237 | mount_one(char *blockDevice, char *directory, char *filesystemType, |
235 | unsigned long flags, char *string_flags, int useMtab, int fakeIt, | 238 | unsigned long flags, char *string_flags, int useMtab, int fakeIt, |
236 | char *mtab_opts, int whineOnErrors) | 239 | char *mtab_opts, int whineOnErrors, int mount_all) |
237 | { | 240 | { |
238 | int status = 0; | 241 | int status = 0; |
239 | 242 | ||
@@ -256,7 +259,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
256 | if (!*noauto_fstype) { | 259 | if (!*noauto_fstype) { |
257 | status = do_mount(blockDevice, directory, filesystemType, | 260 | status = do_mount(blockDevice, directory, filesystemType, |
258 | flags | MS_MGC_VAL, string_flags, | 261 | flags | MS_MGC_VAL, string_flags, |
259 | useMtab, fakeIt, mtab_opts); | 262 | useMtab, fakeIt, mtab_opts, mount_all); |
260 | if (status == TRUE) | 263 | if (status == TRUE) |
261 | break; | 264 | break; |
262 | } | 265 | } |
@@ -264,7 +267,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
264 | } else { | 267 | } else { |
265 | status = do_mount(blockDevice, directory, filesystemType, | 268 | status = do_mount(blockDevice, directory, filesystemType, |
266 | flags | MS_MGC_VAL, string_flags, useMtab, | 269 | flags | MS_MGC_VAL, string_flags, useMtab, |
267 | fakeIt, mtab_opts); | 270 | fakeIt, mtab_opts, mount_all); |
268 | } | 271 | } |
269 | 272 | ||
270 | if (status == FALSE) { | 273 | if (status == FALSE) { |
@@ -450,7 +453,7 @@ singlemount: | |||
450 | } | 453 | } |
451 | #endif | 454 | #endif |
452 | if (!mount_one(device, directory, filesystemType, flags, | 455 | if (!mount_one(device, directory, filesystemType, flags, |
453 | string_flags, useMtab, fakeIt, extra_opts, TRUE)) | 456 | string_flags, useMtab, fakeIt, extra_opts, TRUE, all)) |
454 | rc = EXIT_FAILURE; | 457 | rc = EXIT_FAILURE; |
455 | 458 | ||
456 | if (all == FALSE) | 459 | if (all == FALSE) |