Revision: 3404
Author: [email protected]
Date: Thu Dec  3 00:48:32 2009
Log: 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
http://code.google.com/p/v8/source/detail?r=3404

Modified:
  /branches/bleeding_edge/src/d8.cc

=======================================
--- /branches/bleeding_edge/src/d8.cc   Mon Sep  7 05:37:56 2009
+++ /branches/bleeding_edge/src/d8.cc   Thu Dec  3 00:48:32 2009
@@ -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