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?p=pintos-anon;a=commitdiff_plain;h=161bf03beb0aae6ad38aa884cd534a94737d396a 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.