diff mbox

mount.nfs: print more useful error message

Message ID 537AD1E7.6080404@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee May 20, 2014, 3:54 a.m. UTC
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(-)

Comments

Steve Dickson June 1, 2014, 5:13 p.m. UTC | #1
On 05/19/2014 11:54 PM, Kinglong Mee wrote:
> 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>
Committed... 

steved.

> ---
>  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"),
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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"),