summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-02-16 13:20:34 +0100
committerKay Sievers <kay.sievers@vrfy.org>2007-02-16 13:20:34 +0100
commit6e82f66ea263d432e483505566f8f13ae83f3ac5 (patch)
tree45892a866c579b038d91fcd06c20151de6a0f9dc
parent1a4144498aaf4a457d3dd03c25ccb9b8e1f848c7 (diff)
apply format chars to ATTR before writing to sysfs
-rw-r--r--udev_rules.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/udev_rules.c b/udev_rules.c
index d1c3f042c3..200b4e7024 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -842,18 +842,20 @@ try_parent:
if (pair->key.operation == KEY_OP_ASSIGN) {
const char *key_name = key_pair_name(rule, pair);
- const char *key_value = key_val(rule, &pair->key);
char attr[PATH_SIZE];
+ char value[NAME_SIZE];
FILE *f;
strlcpy(attr, sysfs_path, sizeof(attr));
strlcat(attr, udev->dev->devpath, sizeof(attr));
strlcat(attr, "/", sizeof(attr));
strlcat(attr, key_name, sizeof(attr));
- dbg("write '%s' to '%s'", key_value, attr);
+ strlcpy(value, key_val(rule, &pair->key), sizeof(value));
+ udev_rules_apply_format(udev, value, sizeof(value));
+ info("writing '%s' to sysfs file '%s'", value, attr);
f = fopen(attr, "w");
if (f != NULL) {
- if (fprintf(f, "%s\n", key_value) <= 0)
+ if (fprintf(f, "%s", value) <= 0)
err("error writing ATTR{%s}: %s", attr, strerror(errno));
fclose(f);
} else