std/zig: handle underscore in kernel version

On some distros (e.g. Void Linux) the release field of the tsname
struct may contain an underscore followed by a revision number at the
end. (e.g. 5.8.12_2).
master
Isaac Freund 2020-10-05 23:46:18 +02:00 committed by Andrew Kelley
parent dbc11be038
commit 0741505d6d
1 changed files with 2 additions and 0 deletions

View File

@ -213,6 +213,8 @@ pub const NativeTargetInfo = struct {
// kernel version
const kernel_version = if (mem.indexOfScalar(u8, release, '-')) |pos|
release[0..pos]
else if (mem.indexOfScalar(u8, release, '_')) |pos|
release[0..pos]
else
release;