openvpn: update to 2.5.6
[feed/packages.git] / libs / libudev-zero / patches / 0015-udev_enumerate.c-support-NULL-value-in-match-nomatch.patch
1 From 4154cf252c17297f98a8ca33693ead003b4509da Mon Sep 17 00:00:00 2001
2 From: illiliti <illiliti@protonmail.com>
3 Date: Thu, 16 Dec 2021 07:09:16 +0300
4 Subject: [PATCH 15/15] udev_enumerate.c: support NULL value in match/nomatch
5
6 Fixes: #45
7 ---
8 udev_enumerate.c | 16 +++++-----------
9 1 file changed, 5 insertions(+), 11 deletions(-)
10
11 --- a/udev_enumerate.c
12 +++ b/udev_enumerate.c
13 @@ -193,20 +193,17 @@ static int filter_property(struct udev_e
14
15 static int filter_sysattr(struct udev_enumerate *udev_enumerate, struct udev_device *udev_device)
16 {
17 + const char *sysattr, *value, *value2;
18 struct udev_list_entry *list_entry;
19 - const char *sysattr, *value;
20
21 list_entry = udev_list_entry_get_next(&udev_enumerate->sysattr_nomatch);
22
23 while (list_entry) {
24 sysattr = udev_list_entry_get_name(list_entry);
25 + value2 = udev_list_entry_get_value(list_entry);
26 value = udev_device_get_sysattr_value(udev_device, sysattr);
27
28 - if (!value) {
29 - return 1;
30 - }
31 -
32 - if (fnmatch(udev_list_entry_get_value(list_entry), value, 0) == 0) {
33 + if (value && value2 && fnmatch(value2, value, 0) == 0) {
34 return 0;
35 }
36
37 @@ -218,13 +215,10 @@ static int filter_sysattr(struct udev_en
38 if (list_entry) {
39 while (list_entry) {
40 sysattr = udev_list_entry_get_name(list_entry);
41 + value2 = udev_list_entry_get_value(list_entry);
42 value = udev_device_get_sysattr_value(udev_device, sysattr);
43
44 - if (!value) {
45 - return 0;
46 - }
47 -
48 - if (fnmatch(udev_list_entry_get_value(list_entry), value, 0) == 0) {
49 + if (value && value2 && fnmatch(value2, value, 0) == 0) {
50 return 1;
51 }
52