summaryrefslogtreecommitdiff
path: root/recipes/acpid/acpid-1.0.10/event.c.diff
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2009-10-14 15:04:39 -0700
committerKhem Raj <raj.khem@gmail.com>2009-10-14 15:06:01 -0700
commit9e54aa00b3de07933fabf5f6193a4f40af3b54f9 (patch)
tree5a3a474b492614ce6a5786bcd324e216411cc96c /recipes/acpid/acpid-1.0.10/event.c.diff
parent98f5b4a634bc24e418b23e23a51037a89566c339 (diff)
acpid-1.0.10: Add recipe and patches for version 1.0.10
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes/acpid/acpid-1.0.10/event.c.diff')
-rw-r--r--recipes/acpid/acpid-1.0.10/event.c.diff43
1 files changed, 43 insertions, 0 deletions
diff --git a/recipes/acpid/acpid-1.0.10/event.c.diff b/recipes/acpid/acpid-1.0.10/event.c.diff
new file mode 100644
index 0000000000..ef616a7eb1
--- /dev/null
+++ b/recipes/acpid/acpid-1.0.10/event.c.diff
@@ -0,0 +1,43 @@
+--- acpid-1.0.8.orig/event.c
++++ acpid-1.0.8/event.c
+@@ -23,6 +23,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
++#include <libgen.h>
+ #include <sys/poll.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+@@ -92,6 +93,8 @@
+ struct dirent *dirent;
+ char *file = NULL;
+ int nrules = 0;
++ char *basen = NULL;
++ regex_t preg;
+
+ lock_rules();
+
+@@ -141,10 +144,19 @@
+ continue; /* skip non-regular files */
+ }
+
+- r = parse_file(file);
+- if (r) {
+- enlist_rule(&cmd_list, r);
+- nrules++;
++ /* check for run-parts style filename */
++ basen = basename(file);
++ if (regcomp(&preg, "^[a-zA-Z0-9_-]+$", RULE_REGEX_FLAGS) == 0){
++ if (regexec(&preg, basen, 0, NULL, 0) == 0){
++ r = parse_file(file);
++ if (r) {
++ enlist_rule(&cmd_list, r);
++ nrules++;
++ }
++ } else {
++ acpid_log(LOG_DEBUG, "ignoring conf file %s\n", file);
++ }
++
+ }
+ free(file);
+ }