summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-04-07 13:11:18 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-04-07 13:11:18 +0200
commit24eb4a30982ed18d4716bd59c454a72f161d5982 (patch)
tree901e57029aaf4747a0edecc1ab432be6de022af1 /src/libsystemd
parentbd1acc9f2ffa9c2baf1ddd6bb965352aef5c7446 (diff)
device: fix sysattr newline cutter
Right now, we always drop the last character of all values we write to sysfs. Fix this!
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-device/sd-device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index 0dd0e14eef..b828fa830a 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)