summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils.c14
-rw-r--r--utils.h1
2 files changed, 4 insertions, 11 deletions
diff --git a/utils.c b/utils.c
index d660507f..50e54532 100644
--- a/utils.c
+++ b/utils.c
@@ -1150,23 +1150,17 @@ char *__strncpy__null(char *dest, const char *src, size_t n)
* Returns:
0 if everything is safe and usable
-1 if the label is too long
- -2 if the label contains an invalid character
*/
-int check_label(char *input)
+static int check_label(const char *input)
{
- int i;
int len = strlen(input);
- if (len > BTRFS_LABEL_SIZE) {
+ if (len > BTRFS_LABEL_SIZE - 1) {
+ fprintf(stderr, "ERROR: Label %s is too long (max %d)\n",
+ input, BTRFS_LABEL_SIZE - 1);
return -1;
}
- for (i = 0; i < len; i++) {
- if (input[i] == '/' || input[i] == '\\') {
- return -2;
- }
- }
-
return 0;
}
diff --git a/utils.h b/utils.h
index 60a0fea9..cadb1cb9 100644
--- a/utils.h
+++ b/utils.h
@@ -44,7 +44,6 @@ int check_mounted_where(int fd, const char *file, char *where, int size,
int btrfs_device_already_in_root(struct btrfs_root *root, int fd,
int super_offset);
char *pretty_sizes(u64 size);
-int check_label(char *input);
int get_mountpt(char *dev, char *mntpt, size_t size);
int btrfs_scan_block_devices(int run_ioctl);
u64 parse_size(char *s);