0d3b672e6866fc5c35d7f1317929710dcfb6cccf
[openwrt/openwrt.git] / package / hotplug2 / patches / 100-rules_override.patch
1 diff -ur hotplug2.old/hotplug2.c hotplug2.dev/hotplug2.c
2 --- hotplug2.old/hotplug2.c 2006-10-08 15:18:23.000000000 +0200
3 +++ hotplug2.dev/hotplug2.c 2007-05-05 11:38:51.456551560 +0200
4 @@ -391,6 +391,7 @@
5 int rv = 0;
6 int i;
7 char *coldplug_command = NULL;
8 + char *rules_file = HOTPLUG2_RULE_PATH;
9 sigset_t block_mask;
10
11 struct rules_t *rules = NULL;
12 @@ -435,6 +436,13 @@
13 break;
14
15 modprobe_command = *argv;
16 + } else if (!strcmp(*argv, "--set-rules-file")) {
17 + argv++;
18 + argc--;
19 + if (argc <= 0)
20 + break;
21 +
22 + rules_file = *argv;
23 }
24 }
25 }
26 @@ -443,7 +451,7 @@
27 #ifdef HAVE_RULES
28 if (!dumb) {
29 filemap = MAP_FAILED;
30 - rule_fd = open(HOTPLUG2_RULE_PATH, O_RDONLY | O_NOATIME);
31 + rule_fd = open(rules_file, O_RDONLY | O_NOATIME);
32 if (rule_fd == -1) {
33 dumb = 1;
34 ERROR("rules parse","Unable to open rules file: %s.", strerror(errno));