0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 11:48:54 +02:00

ircd::fs::dev: Cleanup returned string data from sysfs read.

This commit is contained in:
Jason Volk 2020-06-07 00:32:57 -07:00
parent 4d98f8fa8d
commit 680c29601e
2 changed files with 9 additions and 3 deletions

View file

@ -36,6 +36,5 @@ ircd::fs::dev::sysfs(const ulong &id,
const string_view &path)
{
char buf[bufmax];
const auto value(sysfs(buf, id, path));
return lex_cast<T>(rstrip(value, '\n'));
return lex_cast<T>(sysfs(buf, id, path));
}

View file

@ -25,7 +25,14 @@ ircd::fs::dev::sysfs(const mutable_buffer &out,
fs::read_opts opts;
opts.aio = false;
return fs::read(path, out, opts);
string_view ret
{
fs::read(path, out, opts)
};
ret = rstrip(ret, '\n');
ret = rstrip(ret, ' ');
return ret;
}
#else
ircd::string_view