Clear sysattr cache if a null pointer is passed (#255)

* Clear sysattr cache if a null pointer is passed

* remove tabs
This commit is contained in:
NaofumiHonda 2023-08-22 00:17:45 +09:00 committed by GitHub
parent ffc1b77871
commit b9cc389aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1557,9 +1557,15 @@ _public_ int udev_device_set_sysattr_value(struct udev_device *udev_device, cons
dev = udev_device; dev = udev_device;
if (sysattr == NULL) if (sysattr == NULL)
return -EINVAL; return -EINVAL;
if (value == NULL) if (value == NULL) {
value_len = 0; struct udev_list_entry *list_entry;
else
list_entry = udev_list_get_entry(&udev_device->sysattr_value_list);
list_entry = udev_list_entry_get_by_name(list_entry, sysattr);
if (list_entry != NULL)
udev_list_entry_delete(list_entry);
goto out;
} else
value_len = strlen(value); value_len = strlen(value);
strscpyl(path, sizeof(path), udev_device_get_syspath(dev), "/", sysattr, NULL); strscpyl(path, sizeof(path), udev_device_get_syspath(dev), "/", sysattr, NULL);