power: sysfs_read: Do not store newlines

Change-Id: If20b509b489b056ac3b37c208c42bc5407f61802
This commit is contained in:
Christopher N. Hesse 2017-07-08 13:56:25 +02:00
parent f6e983c722
commit 0da5fbf3e2

View file

@ -99,7 +99,12 @@ static int sysfs_read(char *path, char *s, int num_bytes)
ret = -1; ret = -1;
} else { } else {
s[len] = '\0'; // do not store newlines, but terminate the string instead
if (s[len-1] == '\n') {
s[len-1] = '\0';
} else {
s[len] = '\0';
}
} }
close(fd); close(fd);