diff options
author | Karel Zak | 2019-06-17 15:48:28 +0200 |
---|---|---|
committer | Karel Zak | 2019-06-17 15:48:28 +0200 |
commit | bddcf5b81673b4cc362b36bac3caaeabb1738fcc (patch) | |
tree | eb375002908b685c325282469a47bdbc1ff86681 /lib/path.c | |
parent | include/closestream: avoid close more than once (diff) | |
parent | wdctl; read from /sys if necessary (diff) | |
download | kernel-qcow2-util-linux-bddcf5b81673b4cc362b36bac3caaeabb1738fcc.tar.gz kernel-qcow2-util-linux-bddcf5b81673b4cc362b36bac3caaeabb1738fcc.tar.xz kernel-qcow2-util-linux-bddcf5b81673b4cc362b36bac3caaeabb1738fcc.zip |
Merge branch 'topic/wdctl'
Diffstat (limited to 'lib/path.c')
-rw-r--r-- | lib/path.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/path.c b/lib/path.c index f7fd19592..8dce1da40 100644 --- a/lib/path.c +++ b/lib/path.c @@ -610,9 +610,10 @@ int ul_path_read_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char /* Remove tailing newline (usual in sysfs) */ if (rc > 0 && *(buf + rc - 1) == '\n') - --rc; + buf[--rc] = '\0'; + else + buf[rc - 1] = '\0'; - buf[rc] = '\0'; return rc; } |