Commit 04829686 authored by Ben Pfaff's avatar Ben Pfaff Committed by Darshit Shah
Browse files

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.
parent 553856cb
......@@ -838,8 +838,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.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment