chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1a41444
)
apply format chars to ATTR before writing to sysfs
author
Kay Sievers
<kay.sievers@vrfy.org>
Fri, 16 Feb 2007 12:20:34 +0000
(13:20 +0100)
committer
Kay Sievers
<kay.sievers@vrfy.org>
Fri, 16 Feb 2007 12:20:34 +0000
(13:20 +0100)
udev_rules.c
patch
|
blob
|
history
diff --git
a/udev_rules.c
b/udev_rules.c
index d1c3f042c390ce5dd4c913a664159ffce350f1c2..200b4e70242b9b1a6c94879d9d54d5c3a24a615b 100644
(file)
--- 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);
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 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));
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) {
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
err("error writing ATTR{%s}: %s", attr, strerror(errno));
fclose(f);
} else