sd-device: ignore error in device_cache_sysattr_value() and propagate original error...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 18 Feb 2021 14:22:27 +0000 (23:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 20 Feb 2021 19:40:17 +0000 (04:40 +0900)
commitacfc2a1d15560084e077ffb3be472cd117e9020a
tree2c1a1cff54d69cfa19eb6cebd3e7cde0f1ac0c55
parent32a739afe0c14fab00cfe45dfe87e60d59c74ce0
sd-device: ignore error in device_cache_sysattr_value() and propagate original error code

There are three calls of device_cache_sysattr_value(). Two of them are
just caching the value. Hence, let's ignore its failure, and propagate
original error code.

One exception is the last call in sd_device_get_sysattr_value().
Unfortunately, it returns `const char *` instead of `char *`. So,
sd_device object must have the reference of the returned value.
Hence, error in updating the cache by device_cache_sysattr_value()
is critical, and we need to propagate the error in that case.
src/libsystemd/sd-device/sd-device.c
src/libsystemd/sd-device/test-sd-device.c
src/shared/dissect-image.c
src/shared/udev-util.c