mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
fix ENV{TEST}="Test: $env{TEST}"
This commit is contained in:
parent
64e0ce85de
commit
ac528431dd
@ -1245,6 +1245,19 @@ SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="yes", NAME="no"
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="true", NAME="true"
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="bad"
|
||||
EOF
|
||||
},
|
||||
{
|
||||
desc => "ENV{} test (assign 2 times)",
|
||||
subsys => "block",
|
||||
devpath => "/block/sda/sda1",
|
||||
exp_name => "true",
|
||||
rules => <<EOF
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="absolutely-\$env{ASSIGN}"
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="yes", NAME="no"
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="absolutely-true", NAME="true"
|
||||
SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="bad"
|
||||
EOF
|
||||
},
|
||||
{
|
||||
|
10
udev_rules.c
10
udev_rules.c
@ -802,13 +802,19 @@ try_parent:
|
||||
struct key_pair *pair = &rule->env.keys[i];
|
||||
|
||||
if (pair->key.operation == KEY_OP_ASSIGN) {
|
||||
char temp_value[NAME_SIZE];
|
||||
const char *key_name = key_pair_name(rule, pair);
|
||||
const char *value = key_val(rule, &pair->key);
|
||||
char *key_value = name_list_key_add(&udev->env_list, key_name, value);
|
||||
char *key_value;
|
||||
|
||||
/* make sure we don't write to the same string we possibly read from */
|
||||
strlcpy(temp_value, value, sizeof(temp_value));
|
||||
udev_rules_apply_format(udev, temp_value, NAME_SIZE);
|
||||
|
||||
key_value = name_list_key_add(&udev->env_list, key_name, temp_value);
|
||||
if (key_value == NULL)
|
||||
break;
|
||||
|
||||
udev_rules_apply_format(udev, key_value, NAME_SIZE);
|
||||
putenv(key_value);
|
||||
dbg("export ENV '%s'", key_value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user