projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cbf1fae
)
pintos: Fix undefined value warning from Perl on read error.
author
Ben Pfaff
<blp@cs.stanford.edu>
Tue, 9 Feb 2016 04:46:18 +0000
(20:46 -0800)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Tue, 9 Feb 2016 04:46:18 +0000
(20:46 -0800)
When sysread encounters an error, it returns undef, which yields a warning
when compared against 0. This fixes the problem.
src/utils/pintos
patch
|
blob
|
history
diff --git
a/src/utils/pintos
b/src/utils/pintos
index eca4708516e41f3c715d2145e761ba775036ed6a..156421649d943356fe69e2447e55a307bf84fd91 100755
(executable)
--- 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.