summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-enumerate.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-06-03 22:08:46 +0200
committerTom Gundersen <teg@jklm.no>2015-06-03 22:08:46 +0200
commit54f0b4d9a3e3e1b955d0b0021d9678571d91a5ef (patch)
tree2fa5df71f3e422b55dfa18c7bbd707912e56103b /src/libudev/libudev-enumerate.c
parent602ee553e40571eeb92e7a6f397550355ba0228b (diff)
libudev: enumerate - accept NULL parameters in add_match()
This was a regression introduced when moving to sd-device.
Diffstat (limited to 'src/libudev/libudev-enumerate.c')
-rw-r--r--src/libudev/libudev-enumerate.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index 255fbe808d..df088946df 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -196,6 +196,9 @@ _public_ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enume
_public_ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) {
assert_return(udev_enumerate, -EINVAL);
+ if (!subsystem)
+ return 0;
+
return sd_device_enumerator_add_match_subsystem(udev_enumerate->enumerator, subsystem, true);
}
@@ -211,6 +214,9 @@ _public_ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enum
_public_ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) {
assert_return(udev_enumerate, -EINVAL);
+ if (!subsystem)
+ return 0;
+
return sd_device_enumerator_add_match_subsystem(udev_enumerate->enumerator, subsystem, false);
}
@@ -227,6 +233,9 @@ _public_ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_en
_public_ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) {
assert_return(udev_enumerate, -EINVAL);
+ if (!sysattr)
+ return 0;
+
return sd_device_enumerator_add_match_sysattr(udev_enumerate->enumerator, sysattr, value, true);
}
@@ -243,6 +252,9 @@ _public_ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumer
_public_ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) {
assert_return(udev_enumerate, -EINVAL);
+ if (!sysattr)
+ return 0;
+
return sd_device_enumerator_add_match_sysattr(udev_enumerate->enumerator, sysattr, value, false);
}
@@ -259,6 +271,9 @@ _public_ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enum
_public_ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) {
assert_return(udev_enumerate, -EINVAL);
+ if (!property)
+ return 0;
+
return sd_device_enumerator_add_match_property(udev_enumerate->enumerator, property, value);
}
@@ -274,6 +289,9 @@ _public_ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enume
_public_ int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) {
assert_return(udev_enumerate, -EINVAL);
+ if (!tag)
+ return 0;
+
return sd_device_enumerator_add_match_tag(udev_enumerate->enumerator, tag);
}
@@ -335,6 +353,9 @@ _public_ int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev
_public_ int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) {
assert_return(udev_enumerate, -EINVAL);
+ if (!sysname)
+ return 0;
+
return sd_device_enumerator_add_match_sysname(udev_enumerate->enumerator, sysname);
}