From 14066c0e0e24ee307aa53b73e16419d998920625 Mon Sep 17 00:00:00 2001 From: "sgjesse@chromium.org" Date: Thu, 3 Dec 2009 08:48:32 +0000 Subject: [PATCH] Check return code from fwrite BUG=http://code.google.com/p/v8/issues/detail?id=453 TEST=none Review URL: http://codereview.chromium.org/458016 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3404 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/d8.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/d8.cc b/src/d8.cc index e4658b1..dedbd55 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -159,7 +159,11 @@ Handle Shell::Write(const Arguments& args) { printf(" "); } v8::String::Utf8Value str(args[i]); - fwrite(*str, sizeof(**str), str.length(), stdout); + int n = fwrite(*str, sizeof(**str), str.length(), stdout); + if (n != str.length()) { + printf("Error in fwrite\n"); + exit(1); + } } return Undefined(); } @@ -203,7 +207,7 @@ Handle Shell::Load(const Arguments& args) { return ThrowException(String::New("Error loading file")); } if (!ExecuteString(source, String::New(*file), false, false)) { - return ThrowException(String::New("Error executing file")); + return ThrowException(String::New("Error executing file")); } } return Undefined(); -- 2.7.4