]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: make sd_device_get_devtype() return 0 on success again
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 25 Aug 2024 19:01:47 +0000 (04:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 Aug 2024 20:18:14 +0000 (05:18 +0900)
This partially reverts the commit 730b76bd2cd5f0866baa738ae283e3b62544a28f.

Before the commit, the function returned 0 on success, but the commit
made the function always return 1, as if device->devtype is NULL, the
function returns -ENOENT in the above.

Fortunately, udev_device_get_devtype() does not propagate any
non-negative value from sd_device_get_devtype(). Hence, hopefully we can
safely revert the change.

src/libsystemd/sd-device/sd-device.c

index d8d151835c044d7a5d4dc3e45e6deaabd39660fd..dafda626f077d0b15d8778139aa76da017b0e4aa 100644 (file)
@@ -1211,7 +1211,7 @@ _public_ int sd_device_get_devtype(sd_device *device, const char **devtype) {
         if (devtype)
                 *devtype = device->devtype;
 
-        return !!device->devtype;
+        return 0;
 }
 
 _public_ int sd_device_get_parent_with_subsystem_devtype(sd_device *device, const char *subsystem, const char *devtype, sd_device **ret) {