From 5d04aae8969f6c72318ce0a4cde4f027766b1a55 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 17 Jan 2025 10:28:16 +0100 Subject: all: use min/max functions They are shorter, more readable, and don't require temp vars. --- vm/vmimpl/console.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'vm/vmimpl') diff --git a/vm/vmimpl/console.go b/vm/vmimpl/console.go index a2dedeb5c..200c44f73 100644 --- a/vm/vmimpl/console.go +++ b/vm/vmimpl/console.go @@ -61,10 +61,7 @@ func (t *tty) Read(buf []byte) (int, error) { return 0, io.EOF } n, err := syscall.Read(t.fd, buf) - if n < 0 { - n = 0 - } - return n, err + return max(n, 0), err } func (t *tty) Close() error { -- cgit mrf-deployment