Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst PR bin/54944: deal with escaped spaces in N...
details: https://anonhg.NetBSD.org/src/rev/f42ee40d8d10
branches: trunk
changeset: 744565:f42ee40d8d10
user: martin <martin%NetBSD.org@localhost>
date: Thu Feb 06 16:28:10 2020 +0000
description:
PR bin/54944: deal with escaped spaces in NAME= syntax in /etc/fstab.
diffstat:
usr.sbin/sysinst/disks.c | 12 +++++++++++-
usr.sbin/sysinst/txtwalk.c | 11 ++++++++---
2 files changed, 19 insertions(+), 4 deletions(-)
diffs (52 lines):
diff -r 9bf9c308f2d7 -r f42ee40d8d10 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c Thu Feb 06 15:08:04 2020 +0000
+++ b/usr.sbin/sysinst/disks.c Thu Feb 06 16:28:10 2020 +0000
@@ -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 @@
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;
diff -r 9bf9c308f2d7 -r f42ee40d8d10 usr.sbin/sysinst/txtwalk.c
--- a/usr.sbin/sysinst/txtwalk.c Thu Feb 06 15:08:04 2020 +0000
+++ b/usr.sbin/sysinst/txtwalk.c Thu Feb 06 16:28:10 2020 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index