uname: -v: strip final whitespace compatibly with uname(3)

This restores POSIX.1 conformance

PR: 260938
This commit is contained in:
наб 2022-02-18 14:34:40 +01:00 committed by Mateusz Guzik
parent fd0d53f85c
commit 7e05fa3b44

View File

@ -256,8 +256,12 @@ NATIVE_SYSCTL2_GET(version, CTL_KERN, KERN_VERSION) {
p = NATIVE_BUFFER;
n = NATIVE_LENGTH;
for (; n--; ++p)
if (*p == '\n' || *p == '\t')
*p = ' ';
if (*p == '\n' || *p == '\t') {
if (n > 1)
*p = ' ';
else
*p = '\0';
}
} NATIVE_SET;
NATIVE_SYSCTL2_GET(platform, CTL_HW, HW_MACHINE) {