Skip to content

gudev: Fix newline stripping by always reading using udev

Benjamin Berg requested to merge benzea/fix-newline-stripping into master

libudev will strip trailing newline characters ("\r\n") when reading sysfs attributes. The uncached reading functions however bypassed the udev mechanism unnecessarily and then added their own cache on top.

Setting the value to NULL clears the internal cache in systemd. As such, we can simply do this and then fall back to the normal implementation to implement the _uncached version of the sysfs attribute getters.

Merge request reports