[systemd-commits] src/libsystemd
David Herrmann
dvdhrm at kemper.freedesktop.org
Tue Apr 7 04:12:48 PDT 2015
src/libsystemd/sd-device/sd-device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 24eb4a30982ed18d4716bd59c454a72f161d5982
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Tue Apr 7 13:11:18 2015 +0200
device: fix sysattr newline cutter
Right now, we always drop the last character of all values we write to
sysfs. Fix this!
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index 0dd0e14..b828fa8 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -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)
More information about the systemd-commits
mailing list