Allow dashes as a valid character in UFS labels.

Reviewed by:	mckusick, imp, 0mp
MFC after:	2 weeks
Differential Revision:	D18991
This commit is contained in:
Dmitry Morozovsky 2019-01-29 10:21:41 +00:00
parent 93b904b310
commit 1165591e7f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343548
4 changed files with 11 additions and 8 deletions

View File

@ -28,7 +28,7 @@
.\" @(#)newfs.8 8.6 (Berkeley) 5/3/95
.\" $FreeBSD$
.\"
.Dd July 7, 2017
.Dd January 29, 2019
.Dt NEWFS 8
.Os
.Sh NAME
@ -89,7 +89,7 @@ See
for details.
.It Fl L Ar volname
Add a volume label to the new file system.
Legal characters are alphanumerics and underscores.
Legal characters are alphanumerics, dashes, and underscores.
.It Fl N
Cause the file system parameters to be printed out
without really creating the file system.

View File

@ -153,10 +153,10 @@ main(int argc, char *argv[])
volumelabel = optarg;
i = -1;
while (isalnum(volumelabel[++i]) ||
volumelabel[i] == '_');
volumelabel[i] == '_' || volumelabel[i] == '-');
if (volumelabel[i] != '\0') {
errx(1, "bad volume label. Valid characters "
"are alphanumerics and underscores.");
"are alphanumerics, dashes, and underscores.");
}
if (strlen(volumelabel) >= MAXVOLLEN) {
errx(1, "bad volume label. Length is longer than %d.",

View File

@ -28,7 +28,7 @@
.\" @(#)tunefs.8 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
.Dd April 19, 2016
.Dd January 29, 2019
.Dt TUNEFS 8
.Os
.Sh NAME
@ -112,7 +112,7 @@ By default
sets it to half of the space reserved to minfree.
.It Fl L Ar volname
Add/modify an optional file system volume label.
Legal characters are alphanumerics and underscores.
Legal characters are alphanumerics, dashes, and underscores.
.It Fl l Cm enable | disable
Turn on/off MAC multilabel flag.
.It Fl m Ar minfree

View File

@ -189,10 +189,13 @@ main(int argc, char *argv[])
name = "volume label";
Lvalue = optarg;
i = -1;
while (isalnum(Lvalue[++i]) || Lvalue[i] == '_');
while (isalnum(Lvalue[++i]) || Lvalue[i] == '_' ||
Lvalue[i] == '-')
;
if (Lvalue[i] != '\0') {
errx(10, "bad %s. Valid characters are "
"alphanumerics and underscores.", name);
"alphanumerics, dashes, and underscores.",
name);
}
if (strlen(Lvalue) >= MAXVOLLEN) {
errx(10, "bad %s. Length is longer than %d.",