linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mount.nfs: print more useful error message
@ 2014-05-20  3:54 Kinglong Mee
  2014-06-01 17:13 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Kinglong Mee @ 2014-05-20  3:54 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, kinglongmee

When mounting spec of a regular file, mount.nfs print error message as,

# mount -t nfs 127.0.0.1:/root/testfile /mnt/
mount.nfs: mount point /mnt is not a directory
# mount -t nfs 127.0.0.1:/root/testfile /mnt/testfile
mount.nfs: mount point /mnt/testfile is not a directory

This patch lets mount.nfs print more useful message,

# mount -t nfs 127.0.0.1:/root/testfile /mnt/
mount.nfs: mount spec 127.0.0.1:/root/testfile or point /mnt is not a directory
# mount -t nfs 127.0.0.1:/root/testfile /mnt/testfile
mount.nfs: mount point /mnt/testfile is not a directory

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 utils/mount/error.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/utils/mount/error.c b/utils/mount/error.c
index f8fc13f..e06f598 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -215,8 +215,12 @@ void mount_error(const char *spec, const char *mount_point, int error)
 				progname);
 		break;
 	case ENOTDIR:
-		nfs_error(_("%s: mount point %s is not a directory"),
-				progname, mount_point);
+		if (spec)
+			nfs_error(_("%s: mount spec %s or point %s is not a "
+				  "directory"),	progname, spec, mount_point);
+		else
+			nfs_error(_("%s: mount point %s is not a directory"),
+				  progname, mount_point);
 		break;
 	case EBUSY:
 		nfs_error(_("%s: %s is busy or already mounted"),
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-01 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20  3:54 [PATCH] mount.nfs: print more useful error message Kinglong Mee
2014-06-01 17:13 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).