Integrate FreeBSD r335189 for -A option.
Bug: 110053628
Change-Id: Ic59054c7e13849b392971746cdaa901f11552fca
diff --git a/newfs_msdos.c b/newfs_msdos.c
index 2fab87c..cd03164 100644
--- a/newfs_msdos.c
+++ b/newfs_msdos.c
@@ -29,7 +29,7 @@
#ifndef lint
static const char rcsid[] =
- "$FreeBSD: head/sbin/newfs_msdos/newfs_msdos.c 326276 2017-11-27 15:37:16Z pfg $";
+ "$FreeBSD: head/sbin/newfs_msdos/newfs_msdos.c 335189 2018-06-15 06:03:40Z delphij $";
#endif /* not lint */
#include <sys/param.h>
@@ -76,7 +76,7 @@
int
main(int argc, char *argv[])
{
- static const char opts[] = "@:NB:C:F:I:L:O:S:a:b:c:e:f:h:i:k:m:n:o:r:s:T:u:";
+ static const char opts[] = "@:NAB:C:F:I:L:O:S:a:b:c:e:f:h:i:k:m:n:o:r:s:T:u:";
struct msdos_options o;
const char *fname, *dtype;
char buf[MAXPATHLEN];
@@ -92,6 +92,9 @@
case 'N':
o.no_create = 1;
break;
+ case 'A':
+ o.align = true;
+ break;
case 'B':
o.bootstrap = optarg;
break;
@@ -175,6 +178,10 @@
argv += optind;
if (argc < 1 || argc > 2)
usage();
+ if (o.align) {
+ if (o.hidden_sectors_set)
+ errx(1, "align (-A) is incompatible with -r");
+ }
fname = *argv++;
if (!o.create_size && !strchr(fname, '/')) {
snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, fname);