mirror of
https://github.com/systemd/systemd.git
synced 2024-12-12 03:33:44 +08:00
device: fix sysattr newline cutter
Right now, we always drop the last character of all values we write to sysfs. Fix this!
This commit is contained in:
parent
bd1acc9f2f
commit
24eb4a3098
@ -1781,8 +1781,8 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
|
||||
value_len = strlen(_value);
|
||||
|
||||
/* drop trailing newlines */
|
||||
while (value_len > 0 && _value[--value_len] == '\n')
|
||||
_value[value_len] = '\0';
|
||||
while (value_len > 0 && _value[value_len - 1] == '\n')
|
||||
_value[--value_len] = '\0';
|
||||
|
||||
/* value length is limited to 4k */
|
||||
if (value_len > 4096)
|
||||
|
Loading…
Reference in New Issue
Block a user