Merge
diff --git a/mountd/AutoMount.c b/mountd/AutoMount.c
index bfe8ad1..09e9759 100644
--- a/mountd/AutoMount.c
+++ b/mountd/AutoMount.c
@@ -254,9 +254,6 @@
if (result == 0) {
NotifyMediaState(mountPoint, MEDIA_MOUNTED, (flags & MS_RDONLY) != 0);
- } else if (errno == EBUSY) {
- // ignore EBUSY, since it usually means the device is already mounted
- result = 0;
} else {
#if CREATE_MOUNT_POINTS
rmdir(mountPoint);
diff --git a/toolbox/mount.c b/toolbox/mount.c
index ef13e1f..395c943 100644
--- a/toolbox/mount.c
+++ b/toolbox/mount.c
@@ -138,14 +138,17 @@
if (loop) {
int file_fd, device_fd;
+ int flags;
+
+ flags = (rwflag & MS_RDONLY) ? O_RDONLY : O_RDWR;
// FIXME - only one loop mount supported at a time
- file_fd = open(dev, O_RDWR);
+ file_fd = open(dev, flags);
if (file_fd < -1) {
perror("open backing file failed");
return 1;
}
- device_fd = open(LOOP_DEVICE, O_RDWR);
+ device_fd = open(LOOP_DEVICE, flags);
if (device_fd < -1) {
perror("open loop device failed");
close(file_fd);