blob: 94e8a75686cc4c798866de3062483927ad8d6f77 [file] [log] [blame] [raw]
Always try external mount programs at first.
Try 'mount.<fstype>' first, then 'mount_<fstype>'.
diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/sbin/mount/mount.c freebsd-10.3/usr/src/sbin/mount/mount.c
--- /var/tmp/freebsd-10.3-src/usr/src/sbin/mount/mount.c 2016-03-25 09:10:18.000000000 +0800
+++ freebsd-10.3/usr/src/sbin/mount/mount.c 2018-11-07 23:33:33.026775789 +0800
@@ -168,15 +168,12 @@
switch (pid = fork()) {
case -1: /* Error. */
warn("fork");
- exit (1);
+ exit(1);
case 0: /* Child. */
/* Go find an executable. */
execvP(execname, _PATH_SYSPATH, argv);
if (errno == ENOENT) {
- warn("exec %s not found", execname);
- if (execname[0] != '/') {
- warnx("in path: %s", _PATH_SYSPATH);
- }
+ exit(127);
}
exit(1);
default: /* Parent. */
@@ -591,7 +603,7 @@
}
/* Construct the name of the appropriate mount command */
- (void)snprintf(execname, sizeof(execname), "mount_%s", vfstype);
+ (void)snprintf(execname, sizeof(execname), "mount.%s", vfstype);
mnt_argv.c = -1;
append_arg(&mnt_argv, execname);
@@ -605,7 +617,7 @@
if (debug) {
if (use_mountprog(vfstype))
- printf("exec: %s", execname);
+ printf("should exec: %s", execname);
else
printf("mount -t %s", vfstype);
for (i = 1; i < mnt_argv.c; i++)
@@ -617,10 +629,14 @@
return (0);
}
- if (use_mountprog(vfstype)) {
+ ret = exec_mountprog(name, execname, mnt_argv.a);
+ if(ret == 127) {
+ snprintf(execname, sizeof(execname), "mount_%s", vfstype);
ret = exec_mountprog(name, execname, mnt_argv.a);
- } else {
- ret = mount_fs(vfstype, mnt_argv.c, mnt_argv.a);
+ if(ret == 127) {
+ strcpy(execname, "mount");
+ ret = mount_fs(vfstype, mnt_argv.c, mnt_argv.a);
+ }
}
free(optbuf);