From a35e79002d36cca3c272ba5625aec86d6b7a38a8 Mon Sep 17 00:00:00 2001 From: Saul Wold Date: Tue, 9 Apr 2013 23:25:54 -0700 Subject: [PATCH] busybox: fail on no media Upstream-Status: Denied [https://www.mail-archive.com/busybox@busybox.net/msg22354.html] The current behaviour of busybox is to try all fstype when automounting even when no media exists. The util-linux mount command bails when no media exists, so change the behaviour of busybox to do the same. It could also be argued that the KERN_INFO message from btrfs could be removed, but that would be harder to accomplish. Signed-off-by: Saul Wold --- util-linux/mount.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util-linux/mount.c b/util-linux/mount.c index 4e65b6b..9d7a566 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -746,6 +746,14 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero errno = errno_save; } + /* + * Break if there is no media, no point retrying for all + * fs types since there is no media available + */ + if (rc == -1 && errno == ENOMEDIUM) { + bb_perror_msg_and_die("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir); + } + // Should we retry read-only mount? if (vfsflags & MS_RDONLY) break; // no, already was tried