diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-04-25 01:52:00 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-04-25 01:52:00 +0200 |
commit | db6e59df561dbedb89a27d7362d6564847258bfe (patch) | |
tree | 5e738d5d10c06fe3ab64a105f0929d4679d29162 /udev_rules.c | |
parent | 07bc6002cac04de7dc80fae0287695f91b2c3f23 (diff) |
unset variable with ENV{VAR}=""
Diffstat (limited to 'udev_rules.c')
-rw-r--r-- | udev_rules.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/udev_rules.c b/udev_rules.c index 6bd28ad4b7..61b39b45c8 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -831,18 +831,23 @@ try_parent: 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; /* 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; + if (temp_value[0] == '\0') { + name_list_key_remove(&udev->env_list, key_name); + unsetenv(key_name); + info("unset ENV '%s'", key_name); + } else { + char *key_value = name_list_key_add(&udev->env_list, key_name, temp_value); - putenv(key_value); - dbg("export ENV '%s'", key_value); + if (key_value == NULL) + break; + putenv(key_value); + info("set ENV '%s'", key_value); + } } } |