summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-device
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-01-26 15:57:33 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-01-26 16:01:02 +0100
commit49f236937784dfada808c59649575c4fdb1bff91 (patch)
tree1c3d3ad34f036a04e41023227d7cf62b342ed6ef /src/libsystemd/sd-device
parentsd-netlink: fix indentation (diff)
downloadsystemd-49f236937784dfada808c59649575c4fdb1bff91.tar.xz
systemd-49f236937784dfada808c59649575c4fdb1bff91.zip
sd-device: do not use downgrade-to-bool feature
Diffstat (limited to 'src/libsystemd/sd-device')
-rw-r--r--src/libsystemd/sd-device/sd-device.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index d1aa3282bf..00df63edb3 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -231,8 +231,7 @@ _public_ int sd_device_new_from_syspath(sd_device **ret, const char *syspath) {
}
_public_ int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum) {
- char *syspath;
- char id[DECIMAL_STR_MAX(unsigned) * 2 + 1];
+ char id[DECIMAL_STR_MAX(unsigned) * 2 + 1], *syspath;
assert_return(ret, -EINVAL);
assert_return(IN_SET(type, 'b', 'c'), -EINVAL);
@@ -399,7 +398,7 @@ int device_set_devmode(sd_device *device, const char *_devmode) {
}
int device_set_devnum(sd_device *device, const char *major, const char *minor) {
- unsigned maj = 0, min = 0;
+ unsigned maj, min = 0;
int r;
assert(device);
@@ -408,7 +407,7 @@ int device_set_devnum(sd_device *device, const char *major, const char *minor) {
r = safe_atou(major, &maj);
if (r < 0)
return r;
- if (!maj)
+ if (maj == 0)
return 0;
if (minor) {