blob: ede6d8529afbfa97b98947de7824567daac0c963 [file] [log] [blame] [raw]
mount(8): support '-o remount' to improve GNU/Linux compatibility.
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/sbin/mount/mount.c freebsd-11.1/usr/src/sbin/mount/mount.c
--- /usr/src/sbin/mount/mount.c 2017-07-21 07:43:26.000000000 +0800
+++ freebsd-11.1/usr/src/sbin/mount/mount.c 2019-03-22 13:48:32.996295000 +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':