blob: a4943b1e0aa130ba722c7cc620939cf53836071b [file] [log] [blame] [raw]
mount(8): support '-o remount' to improve GNU/Linux compatibility.
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-06 02:10:30.000000000 +0800
@@ -280,9 +280,24 @@
break;
case 'o':
if (*optarg) {
- options = catopt(options, optarg);
- if (specified_ro(optarg))
- ro = 1;
+ char *remount_opt = strstr(optarg, "remount");
+ if(remount_opt &&
+ (remount_opt == optarg || remount_opt[-1] == ',') &&
+ (!remount_opt[7] || remount_opt[7] == ',')) {
+ init_flags |= MNT_UPDATE;
+ if(remount_opt != optarg) {
+ remount_opt[-1] = 0;
+ options = catopt(options, optarg);
+ if(specified_ro(optarg)) ro = 1;
+ }
+ if(remount_opt[7] == ',') {
+ options = catopt(options, remount_opt + 8);
+ if(specified_ro(remount_opt + 8)) ro = 1;
+ }
+ } else {
+ options = catopt(options, optarg);
+ if (specified_ro(optarg)) ro = 1;
+ }
}
break;
case 'p':