summaryrefslogtreecommitdiff
path: root/util-linux/mount.c
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/mount.c
parentf223efbcde63c0c01e5b1331f2fc7f1a9c812f20 (diff)
downloadbusybox-w32-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.tar.gz
busybox-w32-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.tar.bz2
busybox-w32-0e2c9fb4e09fb0c5a47ddc74b0ba53238570599e.zip
mount: print errno on NFS error (again)
Diffstat (limited to '')
-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)
1439 // Might this be an NFS filesystem? 1439 // Might this be an NFS filesystem?
1440 1440
1441 if (ENABLE_FEATURE_MOUNT_NFS 1441 if (ENABLE_FEATURE_MOUNT_NFS
1442 && (!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) 1442 && (!mp->mnt_type || !strcmp(mp->mnt_type, "nfs"))
1443 && strchr(mp->mnt_fsname, ':') != NULL 1443 && strchr(mp->mnt_fsname, ':') != NULL
1444 ) { 1444 ) {
1445 rc = nfsmount(mp, vfsflags, filteropts); 1445 rc = nfsmount(mp, vfsflags, filteropts);
@@ -1458,15 +1458,12 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1458 1458
1459 if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) { 1459 if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) {
1460 loopFile = bb_simplify_path(mp->mnt_fsname); 1460 loopFile = bb_simplify_path(mp->mnt_fsname);
1461 mp->mnt_fsname = 0; 1461 mp->mnt_fsname = NULL; /* will receive malloced loop dev name */
1462 switch (set_loop(&(mp->mnt_fsname), loopFile, 0)) { 1462 if (set_loop(&(mp->mnt_fsname), loopFile, 0) < 0) {
1463 case 0: 1463 if (errno == EPERM || errno == EACCES)
1464 case 1: 1464 bb_error_msg(bb_msg_perm_denied_are_you_root);
1465 break; 1465 else
1466 default: 1466 bb_perror_msg("cannot setup loop device");
1467 bb_error_msg( errno == EPERM || errno == EACCES
1468 ? bb_msg_perm_denied_are_you_root
1469 : "cannot setup loop device");
1470 return errno; 1467 return errno;
1471 } 1468 }
1472 1469
@@ -1516,10 +1513,10 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1516 if (ENABLE_FEATURE_CLEAN_UP) 1513 if (ENABLE_FEATURE_CLEAN_UP)
1517 free(filteropts); 1514 free(filteropts);
1518 1515
1519 if (rc && errno == EBUSY && ignore_busy) rc = 0; 1516 if (rc && errno == EBUSY && ignore_busy)
1517 rc = 0;
1520 if (rc < 0) 1518 if (rc < 0)
1521 /* perror here sometimes says "mounting ... on ... failed: Success" */ 1519 bb_perror_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
1522 bb_error_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
1523 1520
1524 return rc; 1521 return rc;
1525} 1522}
@@ -1527,7 +1524,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1527// Parse options, if necessary parse fstab/mtab, and call singlemount for 1524// Parse options, if necessary parse fstab/mtab, and call singlemount for
1528// each directory to be mounted. 1525// each directory to be mounted.
1529 1526
1530const char must_be_root[] = "you must be root"; 1527static const char must_be_root[] = "you must be root";
1531 1528
1532int mount_main(int argc, char **argv); 1529int mount_main(int argc, char **argv);
1533int mount_main(int argc, char **argv) 1530int mount_main(int argc, char **argv)