From b90543d9ae3de7ae673030d4515b7effcf737ebb Mon Sep 17 00:00:00 2001 From: dautor Date: Sat, 23 Nov 2024 12:59:25 +0100 Subject: Add a better error message when mounting fails --- src/util.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 13ba790..d7d07e7 100644 --- a/src/util.c +++ b/src/util.c @@ -367,12 +367,12 @@ mount_unionfs(char const *Target, char const *Source, bool Below) char SourceR[MAXPATHLEN]; if(checkpath(Target, TargetR) != 0) { - fprintf(stderr, "checkpath %s\n", TargetR); + fprintf(stderr, "'%s' is not a valid mount target\n", TargetR); return -1; } if(checkpath(Source, SourceR) != 0) { - fprintf(stderr, "checkpath %s\n", SourceR); + fprintf(stderr, "'%s' is not a valid directory\n", SourceR); return -1; } if(subdir(TargetR, SourceR) || subdir(SourceR, TargetR)) @@ -391,7 +391,7 @@ mount_unionfs(char const *Target, char const *Source, bool Below) build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if(nmount(iov, (u32)iovlen, 0)) { - fprintf(stderr, "nmount unionfs %s: %s\n", SourceR, errmsg); + fprintf(stderr, "nmount unionfs '%s' failed: %s\n", SourceR, errmsg); return -1; } return 0; @@ -403,7 +403,7 @@ mount_devfs(char const *Target) char TargetR[MAXPATHLEN]; if(checkpath(Target, TargetR) != 0) { - fprintf(stderr, "checkpath %s\n", TargetR); + fprintf(stderr, "'%s' is not a valid mount target\n", TargetR); return -1; } char errmsg[255]; @@ -416,7 +416,7 @@ mount_devfs(char const *Target) build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if(nmount(iov, (u32)iovlen, 0)) { - fprintf(stderr, "nmount devfs: %s\n", errmsg); + fprintf(stderr, "nmount devfs failed: %s\n", errmsg); return -1; } return 0; @@ -429,12 +429,12 @@ mount_nullfs(char const *Target, char const *Source) char SourceR[MAXPATHLEN]; if(checkpath(Target, TargetR) != 0) { - fprintf(stderr, "checkpath %s\n", TargetR); + fprintf(stderr, "'%s' is not a valid mount target\n", TargetR); return -1; } if(checkpath(Source, SourceR) != 0) { - fprintf(stderr, "checkpath %s\n", SourceR); + fprintf(stderr, "'%s' is not a valid directory\n", SourceR); return -1; } if(subdir(TargetR, SourceR) || subdir(SourceR, TargetR)) @@ -452,7 +452,7 @@ mount_nullfs(char const *Target, char const *Source) build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if(nmount(iov, (u32)iovlen, 0)) { - fprintf(stderr, "nmount nullfs %s: %s\n", SourceR, errmsg); + fprintf(stderr, "nmount nullfs '%s' failed: %s\n", SourceR, errmsg); return -1; } return 0; -- cgit v1.2.3