blob: 5e60d2ec20bf5230b884249f2e1e1a7149e9b418 [file] [log] [blame] [raw]
mount(8): support '-o remount' to improve GNU/Linux compatibility.
diff -ru --exclude-from freebsd-src-diff-exclude-names /var/archive3/public/freebsd-releng-10.4-src/sbin/mount/mount.c freebsd-10.4/sbin/mount/mount.c
--- /var/archive3/public/freebsd-releng-10.4-src/sbin/mount/mount.c 2017-09-29 08:21:17.000000000 +0800
+++ freebsd-10.4/sbin/mount/mount.c 2019-08-18 09:40:40.812178696 +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':