|
|
3cf43e5 |
--- nfs-utils-1.1.0/utils/mount/mount.c.orig 2007-07-18 16:26:01.000000000 -0400
|
|
|
3cf43e5 |
+++ nfs-utils-1.1.0/utils/mount/mount.c 2007-07-18 16:37:34.000000000 -0400
|
|
|
3cf43e5 |
@@ -286,17 +286,24 @@ static void parse_opts (const char *opti
|
|
|
0471bf2 |
}
|
|
|
2d06576 |
}
|
|
|
2d06576 |
|
|
|
2d06576 |
-static void mount_error(char *node)
|
|
|
0471bf2 |
+static void mount_error(char *mount_point, char *node)
|
|
|
2d06576 |
{
|
|
|
2d06576 |
switch(errno) {
|
|
|
2d06576 |
case ENOTDIR:
|
|
|
3cf43e5 |
- fprintf(stderr, "%s: mount point %s is not a directory\n", progname, node);
|
|
|
3cf43e5 |
+ fprintf(stderr, "%s: mount point %s is not a directory\n",
|
|
|
3cf43e5 |
+ progname, mount_point);
|
|
|
3cf43e5 |
break;
|
|
|
3cf43e5 |
case EBUSY:
|
|
|
3cf43e5 |
- fprintf(stderr, "%s: %s is already mounted or busy\n", progname, node);
|
|
|
3cf43e5 |
+ fprintf(stderr, "%s: %s is already mounted or busy\n", progname,
|
|
|
3cf43e5 |
+ mount_point);
|
|
|
2d06576 |
break;
|
|
|
2d06576 |
case ENOENT:
|
|
|
2d06576 |
- fprintf(stderr, "%s: mount point %s does not exist\n", progname, node);
|
|
|
0471bf2 |
+ if (node)
|
|
|
2d06576 |
+ fprintf(stderr, "%s: %s failed, reason given by server: %s\n",
|
|
|
2d06576 |
+ progname, node, strerror(errno));
|
|
|
0471bf2 |
+ else
|
|
|
3cf43e5 |
+ fprintf(stderr, "%s: mount point %s does not exist\n", progname,
|
|
|
3cf43e5 |
+ mount_point);
|
|
|
2d06576 |
break;
|
|
|
2d06576 |
default:
|
|
|
2d06576 |
fprintf(stderr, "%s: %s\n", progname, strerror(errno));
|
|
|
3cf43e5 |
@@ -352,6 +359,26 @@ static int start_statd()
|
|
|
0471bf2 |
#endif
|
|
|
0471bf2 |
return 0;
|
|
|
2d06576 |
}
|
|
|
f84cc58 |
+static int chk_mountpoint(char *mount_point)
|
|
|
2d06576 |
+{
|
|
|
2d06576 |
+ struct stat sb;
|
|
|
2d06576 |
+
|
|
|
2d06576 |
+ if (stat(mount_point, &sb) < 0){
|
|
|
2d06576 |
+ mount_error(mount_point, NULL);
|
|
|
2d06576 |
+ return 1;
|
|
|
2d06576 |
+ }
|
|
|
2d06576 |
+ if (S_ISDIR(sb.st_mode) == 0){
|
|
|
2d06576 |
+ errno = ENOTDIR;
|
|
|
2d06576 |
+ mount_error(mount_point, NULL);
|
|
|
2d06576 |
+ return 1;
|
|
|
2d06576 |
+ }
|
|
|
2d06576 |
+ if (access(mount_point, X_OK) < 0) {
|
|
|
2d06576 |
+ mount_error(mount_point, NULL);
|
|
|
2d06576 |
+ return 1;
|
|
|
2d06576 |
+ }
|
|
|
2d06576 |
+
|
|
|
2d06576 |
+ return 0;
|
|
|
2d06576 |
+}
|
|
|
2d06576 |
|
|
|
2d06576 |
int main(int argc, char *argv[])
|
|
|
0471bf2 |
{
|
|
|
3cf43e5 |
@@ -509,6 +536,9 @@ int main(int argc, char *argv[])
|
|
|
0471bf2 |
}
|
|
|
2d06576 |
}
|
|
|
2d06576 |
|
|
|
2d06576 |
+ if (chk_mountpoint(mount_point))
|
|
|
0471bf2 |
+ exit(1);
|
|
|
2d06576 |
+
|
|
|
0471bf2 |
if (nfs_mount_vers == 4)
|
|
|
0471bf2 |
mnt_err = nfs4mount(spec, mount_point, &flags, &extra_opts, &mount_opts, 0);
|
|
|
0471bf2 |
else {
|
|
|
3cf43e5 |
@@ -539,7 +569,7 @@ int main(int argc, char *argv[])
|
|
|
0471bf2 |
mount_opts);
|
|
|
2d06576 |
|
|
|
2d06576 |
if (mnt_err) {
|
|
|
2d06576 |
- mount_error(mount_point);
|
|
|
2d06576 |
+ mount_error(mount_point, spec);
|
|
|
2d06576 |
exit(EX_FAIL);
|
|
|
2d06576 |
}
|
|
|
2d06576 |
}
|