mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
solid: chop non-printable character at the end from DevinfoDevice::stringByName()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e377ab775a
commit
82e73a2b72
1 changed files with 6 additions and 1 deletions
|
@ -289,7 +289,12 @@ QByteArray DevinfoDevice::stringByName(const char* sysctlname)
|
|||
// qWarning() << "sysctlbyname failed" << sysctlname;
|
||||
return QByteArray();
|
||||
}
|
||||
return QByteArray(sysctlbuff, sysctlbuffsize);
|
||||
QByteArray result(sysctlbuff, sysctlbuffsize);
|
||||
// chop non-printable character at the end, whatever it is
|
||||
if (!result.isEmpty() && !::isprint(result.at(result.size() - 1))) {
|
||||
result.chop(1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
qlonglong DevinfoDevice::integerByName(const char* sysctlname)
|
||||
|
|
Loading…
Add table
Reference in a new issue