summaryrefslogtreecommitdiff
path: root/testing/udev/0001-split-usr-always-read-config-files-from-lib-udev.patch
blob: 7873dc337853be4930544347fee9b440391b3d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 12250c0acf747d4ed538927ad7604356b93fb444 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Sat, 3 Mar 2012 12:28:15 +0100
Subject: [PATCH 1/2] split /usr: always read config files from /lib/udev

This means we don't need a flagday in order to move udev to use
/usr/lib/udev/rules.d
---
 src/libudev.c |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/libudev.c b/src/libudev.c
index d954dae..4da6309 100644
--- a/src/libudev.c
+++ b/src/libudev.c
@@ -43,8 +43,8 @@ struct udev {
         void *userdata;
         char *sys_path;
         char *dev_path;
-        char *rules_path[4];
-        unsigned long long rules_path_ts[4];
+        char *rules_path[5];
+        unsigned long long rules_path_ts[5];
         int rules_path_count;
         char *run_path;
         struct udev_list properties_list;
@@ -255,9 +255,14 @@ UDEV_EXPORT struct udev *udev_new(void)
                         goto err;
 
         if (udev->rules_path[0] == NULL) {
-                /* /usr/lib/udev -- system rules */
-                udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d");
+                /* /lib/udev -- compat for system rules */
+                udev->rules_path[0] = strdup("/lib/udev/rules.d");
                 if (!udev->rules_path[0])
+                       goto err;
+
+                /* /usr/lib/udev -- system rules */
+                udev->rules_path[1] = strdup(PKGLIBEXECDIR "/rules.d");
+                if (!udev->rules_path[1])
                         goto err;
 
                 /* /run/udev -- runtime rules */
@@ -265,11 +270,11 @@ UDEV_EXPORT struct udev *udev_new(void)
                         goto err;
 
                 /* /etc/udev -- local administration rules */
-                udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d");
-                if (!udev->rules_path[1])
+                udev->rules_path[3] = strdup(SYSCONFDIR "/udev/rules.d");
+                if (!udev->rules_path[3])
                         goto err;
 
-                udev->rules_path_count = 3;
+                udev->rules_path_count = 4;
         }
 
         dbg(udev, "context %p created\n", udev);
@@ -278,7 +283,8 @@ UDEV_EXPORT struct udev *udev_new(void)
         dbg(udev, "dev_path='%s'\n", udev->dev_path);
         dbg(udev, "sys_path='%s'\n", udev->sys_path);
         dbg(udev, "run_path='%s'\n", udev->run_path);
-        dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]);
+        dbg(udev, "rules_path='%s':'%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1],
+              udev->rules_path[2], udev->rules_path[3]);
         free(config_file);
         return udev;
 err:
@@ -325,6 +331,7 @@ UDEV_EXPORT void udev_unref(struct udev *udev)
         free(udev->rules_path[0]);
         free(udev->rules_path[1]);
         free(udev->rules_path[2]);
+        free(udev->rules_path[3]);
         free(udev->run_path);
         dbg(udev, "context %p released\n", udev);
         free(udev);
-- 
1.7.10