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