Reviewers: Mads Ager,

Description:
Check return code from fwrite

BUG=http://code.google.com/p/v8/issues/detail?id=453
TEST=none

Please review this at http://codereview.chromium.org/458016

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/d8.cc


Index: src/d8.cc
===================================================================
--- src/d8.cc   (revision 3400)
+++ src/d8.cc   (working copy)
@@ -159,7 +159,11 @@
        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 @@
        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();


-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to