PR bin/54944: deal with escaped spaces in NAME= syntax in /etc/fstab.
This commit is contained in:
parent
bc25142e5e
commit
7cc1a7bbc8
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disks.c,v 1.63 2020/02/06 10:42:06 martin Exp $ */
|
||||
/* $NetBSD: disks.c,v 1.64 2020/02/06 16:28:10 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -1520,6 +1520,16 @@ process_found_fs(struct data *list, size_t num, const struct lookfor *item,
|
||||
|
||||
if (strcmp(item->head, name_prefix) == 0) {
|
||||
/* this fstab entry uses NAME= syntax */
|
||||
|
||||
/* unescape */
|
||||
char *src, *dst;
|
||||
for (src = list[0].u.s_val, dst =src; src[0] != 0; ) {
|
||||
if (src[0] == '\\' && src[1] != 0)
|
||||
src++;
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = 0;
|
||||
|
||||
if (!find_part_by_name(list[0].u.s_val,
|
||||
&parts, &pno) || parts == NULL || pno == NO_PART)
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: txtwalk.c,v 1.2 2019/08/07 10:08:04 martin Exp $ */
|
||||
/* $NetBSD: txtwalk.c,v 1.3 2020/02/06 16:28:10 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -239,9 +239,14 @@ finddata(const struct lookfor *item, char *line, struct data *found, size_t *num
|
||||
break;
|
||||
case 's': /* Matches a 'space' separated string. */
|
||||
len = 0;
|
||||
while (line[len] && !isspace((unsigned char)line[len])
|
||||
&& line[len] != fmt[1])
|
||||
while (line[len]
|
||||
&& !isspace((unsigned char)line[len])
|
||||
&& line[len] != fmt[1]) {
|
||||
if (line[len] == '\\'
|
||||
&& line[len] != 0)
|
||||
len++;
|
||||
len++;
|
||||
}
|
||||
found[*numfound].what = STR;
|
||||
found[(*numfound)++].u.s_val = line;
|
||||
line[len] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user