1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-26 08:55:18 +03:00

[PATCH] namedev: skip backslashes only if followed by newline

Fix from: Hannes Reinecke <hare@suse.de>
namedev_parse is a bit overzealous when in comes to handling backspaces;
it always eats up backspaces regardless of anything beyond that. This
means it is impossible to enter '\t' in a rule. Quite a bit of fun when
you're trying to write regexps.
This commit is contained in:
kay.sievers@vrfy.org 2005-02-26 02:52:04 +01:00 committed by Greg KH
parent 9c020c6016
commit 77313cd0d1
2 changed files with 10 additions and 1 deletions

View File

@ -153,7 +153,7 @@ static int namedev_parse(const char *filename, void *data)
/* skip backslash and newline from multi line rules */
for (i = j = 0; i < count; i++) {
if (bufline[i] == '\\' || bufline[i] == '\n')
if (bufline[i] == '\\' && bufline[i+1] == '\n')
continue;
line[j++] = bufline[i];

View File

@ -192,6 +192,15 @@ EOF
KERNEL="ttyUSB0", \\
NAME="visor"
EOF
},
{
desc => "preserve backslashes, if they are not for a newline",
subsys => "tty",
devpath => "/class/tty/ttyUSB0",
exp_name => "aaa",
conf => <<EOF
KERNEL="ttyUSB0", PROGRAM="/bin/echo -e \\101", RESULT="A", NAME="aaa"
EOF
},
{