mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-01-26 08:59:58 +07: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:
parent
9c020c6016
commit
77313cd0d1
@ -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];
|
||||
|
@ -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
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user