summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-06-30 21:50:22 +0200
committerKay Sievers <kay.sievers@suse.de>2005-06-30 21:50:22 +0200
commitbe0856c841e248c491e0fdea013a7af0f61a76b1 (patch)
tree13c3d45b829ff4734abfd247cfaa7e0657aa2d39 /udev_rules_parse.c
parentaaff09a30ab849186c0d4ad8bde83876d7a1a63d (diff)
prepare RELEASE-NOTES
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index 4979feddc1..929a5e6f4c 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -377,9 +377,26 @@ static int rules_parse(const char *filename)
if (strncasecmp(key, KEY_IMPORT, sizeof(KEY_IMPORT)-1) == 0) {
attr = get_key_attribute(key + sizeof(KEY_IMPORT)-1);
- if (attr && strstr(attr, "exec")) {
+ if (attr && strstr(attr, "program")) {
dbg(KEY_IMPORT" will be executed");
rule.import_exec = 1;
+ } else if (attr && strstr(attr, "file")) {
+ dbg(KEY_IMPORT" will be included as file");
+ } else {
+ /* figure it out if it is executable */
+ char file[PATH_SIZE];
+ char *pos;
+ struct stat stats;
+
+ strlcpy(file, value, sizeof(file));
+ pos = strchr(file, ' ');
+ if (pos)
+ pos[0] = '\0';
+ dbg(KEY_IMPORT" auto mode for '%s'", file);
+ if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) {
+ dbg(KEY_IMPORT" is executable, will be executed");
+ rule.import_exec = 1;
+ }
}
strlcpy(rule.import, value, sizeof(rule.import));
rule.import_operation = operation;