From: Ben Pfaff Date: Tue, 9 Feb 2016 04:46:18 +0000 (-0800) Subject: pintos: Fix undefined value warning from Perl on read error. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfb59a37538f8fd727bae352ac4bf9e37b8ad211;p=pintos-anon pintos: Fix undefined value warning from Perl on read error. When sysread encounters an error, it returns undef, which yields a warning when compared against 0. This fixes the problem. --- diff --git a/src/utils/pintos b/src/utils/pintos index eca4708..1564216 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -827,8 +827,8 @@ sub xsystem { # Read and print out pipe data. my ($len) = length ($buf); - waitpid ($pid, 0), last - if sysread ($in, $buf, 4096, $len) <= 0; + my ($n_read) = sysread ($in, $buf, 4096, $len); + waitpid ($pid, 0), last if !defined ($n_read) || $n_read <= 0; print substr ($buf, $len); # Remove full lines from $buf and scan them for keywords.