]> Cypherpunks repositories - gostls13.git/commitdiff
internal/poll: eliminate the redundant conditional branch for isKernelVersionGE53
authorAndy Pan <i@andypan.me>
Thu, 4 Apr 2024 08:40:52 +0000 (16:40 +0800)
committerTobias Klauser <tobias.klauser@gmail.com>
Thu, 4 Apr 2024 17:40:10 +0000 (17:40 +0000)
Follow up CL 573755

Change-Id: I27c7571d3ef1274cf2c6892e678f946f9b65de33
Reviewed-on: https://go-review.googlesource.com/c/go/+/576416
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
src/internal/poll/copy_file_range_linux.go

index 1a32236b123350e329ea849ad47012e4ac1aeb6d..3d51333d73e9cf93823a471dae57d233e2be0c79 100644 (file)
@@ -15,10 +15,7 @@ var isKernelVersionGE53 = sync.OnceValue(func() bool {
        // copy_file_range(2) is broken in various ways on kernels older than 5.3,
        // see https://go.dev/issue/42400 and
        // https://man7.org/linux/man-pages/man2/copy_file_range.2.html#VERSIONS
-       if major > 5 || (major == 5 && minor >= 3) {
-               return true
-       }
-       return false
+       return major > 5 || (major == 5 && minor >= 3)
 })
 
 const maxCopyFileRangeRound = 1 << 30