From: sgjesse@chromium.org Date: Thu, 3 Dec 2009 08:48:32 +0000 (+0000) Subject: Check return code from fwrite X-Git-Tag: upstream/4.7.83~22860 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14066c0e0e24ee307aa53b73e16419d998920625;p=platform%2Fupstream%2Fv8.git 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 --- 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();