From 9c12c25f0f8be892f192fcfa8f4c11f9a2b9ef42 Mon Sep 17 00:00:00 2001 From: marck Date: Tue, 12 Feb 2019 14:03:39 +0000 Subject: [PATCH] MFC 343548: Allow dashes as a valid character in UFS labels. --- sbin/newfs/newfs.8 | 4 ++-- sbin/newfs/newfs.c | 4 ++-- sbin/tunefs/tunefs.8 | 4 ++-- sbin/tunefs/tunefs.c | 7 +++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index d9b30e9a939..91e681064df 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -28,7 +28,7 @@ .\" @(#)newfs.8 8.6 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" -.Dd July 15, 2015 +.Dd January 29, 2019 .Dt NEWFS 8 .Os .Sh NAME @@ -91,7 +91,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. diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 54e20b1776c..c8c1e431060 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -151,10 +151,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.", diff --git a/sbin/tunefs/tunefs.8 b/sbin/tunefs/tunefs.8 index 963830cab5d..e02ef02a9c8 100644 --- a/sbin/tunefs/tunefs.8 +++ b/sbin/tunefs/tunefs.8 @@ -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 diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index aa9e208ad9b..2d67729e63c 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -184,10 +184,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.", -- 2.45.0