[MLton-commit] r6597

Matthew Fluet fluet at mlton.org
Sun Apr 20 15:04:24 PDT 2008


Improve error message with fread_safe.

----------------------------------------------------------------------

U   mlton/trunk/runtime/util/safe.h

----------------------------------------------------------------------

Modified: mlton/trunk/runtime/util/safe.h
===================================================================
--- mlton/trunk/runtime/util/safe.h	2008-04-20 22:04:19 UTC (rev 6596)
+++ mlton/trunk/runtime/util/safe.h	2008-04-20 22:04:23 UTC (rev 6597)
@@ -48,13 +48,10 @@
 
   res = fread (buf, size, count, f);
   if (res != count) {
-    if (feof (f))
-       fprintf (stderr, "eof\n");
-    else
-       fprintf (stderr, "errno = %d\n", ferror (f));
     diee ("fread ("FMTPTR", %"PRIuMAX", %"PRIuMAX", _) failed "
-          "(only read %"PRIuMAX").\n",
-          (uintptr_t)buf, (uintmax_t)size, (uintmax_t)count, (uintmax_t)res);
+          "(only read %"PRIuMAX"%s).\n",
+          (uintptr_t)buf, (uintmax_t)size, (uintmax_t)count, (uintmax_t)res,
+          feof (f) ? "; eof" : "");
   }
 }
 




More information about the MLton-commit mailing list