From: Yu Watanabe Date: Sat, 20 Feb 2021 06:26:54 +0000 (+0900) Subject: sd-device: add a brief comment in device_cache_sysattr_value() X-Git-Tag: v248-rc1~19^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=66efcbb149c09308b6a911ff37380034ed32871b;p=thirdparty%2Fsystemd.git sd-device: add a brief comment in device_cache_sysattr_value() --- diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index dad87f39c9a..8aa47f2fdd3 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -1829,6 +1829,7 @@ static int device_cache_sysattr_value(sd_device *device, const char *key, char * /* This takes the reference of the input value. The input value may be NULL. * This replaces the value if it already exists. */ + /* First, remove the old cache entry. So, we do not need to clear cache on error. */ old_value = hashmap_remove2(device->sysattr_values, key, (void **) &new_key); if (!new_key) { new_key = strdup(key);