aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-03 14:16:24 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-03 14:16:24 +0000
commit0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e (patch)
treeab1416450c6c339fdbe3422a4e4243e7d2098541 /util-linux
parentf223efbcde63c0c01e5b1331f2fc7f1a9c812f20 (diff)
downloadbusybox-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.tar.gz
mount: print errno on NFS error (again)
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mount.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 7ee24ca14..a7b0a98f0 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1439,7 +1439,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
// Might this be an NFS filesystem?
if (ENABLE_FEATURE_MOUNT_NFS
- && (!mp->mnt_type || !strcmp(mp->mnt_type,"nfs"))
+ && (!mp->mnt_type || !strcmp(mp->mnt_type, "nfs"))
&& strchr(mp->mnt_fsname, ':') != NULL
) {
rc = nfsmount(mp, vfsflags, filteropts);
@@ -1458,15 +1458,12 @@ static int singlemount(struct mntent *mp, int ignore_busy)
if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) {
loopFile = bb_simplify_path(mp->mnt_fsname);
- mp->mnt_fsname = 0;
- switch (set_loop(&(mp->mnt_fsname), loopFile, 0)) {
- case 0:
- case 1:
- break;
- default:
- bb_error_msg( errno == EPERM || errno == EACCES
- ? bb_msg_perm_denied_are_you_root
- : "cannot setup loop device");
+ mp->mnt_fsname = NULL; /* will receive malloced loop dev name */
+ if (set_loop(&(mp->mnt_fsname), loopFile, 0) < 0) {
+ if (errno == EPERM || errno == EACCES)
+ bb_error_msg(bb_msg_perm_denied_are_you_root);
+ else
+ bb_perror_msg("cannot setup loop device");
return errno;
}
@@ -1516,10 +1513,10 @@ static int singlemount(struct mntent *mp, int ignore_busy)
if (ENABLE_FEATURE_CLEAN_UP)
free(filteropts);
- if (rc && errno == EBUSY && ignore_busy) rc = 0;
+ if (rc && errno == EBUSY && ignore_busy)
+ rc = 0;
if (rc < 0)
- /* perror here sometimes says "mounting ... on ... failed: Success" */
- bb_error_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
+ bb_perror_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
return rc;
}
@@ -1527,7 +1524,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
// Parse options, if necessary parse fstab/mtab, and call singlemount for
// each directory to be mounted.
-const char must_be_root[] = "you must be root";
+static const char must_be_root[] = "you must be root";
int mount_main(int argc, char **argv);
int mount_main(int argc, char **argv)