From 161bf03beb0aae6ad38aa884cd534a94737d396a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 8 Feb 2016 20:46:18 -0800 Subject: [PATCH] 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. --- src/utils/pintos | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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. -- 2.30.2