5bfea8905219af1c76c026d3bb1c537f7138b84f
kent
  Tue Apr 30 17:15:01 2013 -0700
Improving error reporting in mustWriteFd.
diff --git src/lib/common.c src/lib/common.c
index 978665d..ed87f41 100644
--- src/lib/common.c
+++ src/lib/common.c
@@ -2594,31 +2594,37 @@
     actualSize = read(fd, cbuf, size);
     if (actualSize < 0)
 	errnoAbort("Error reading %lld bytes", (long long)size);
     if (actualSize == 0)
 	errAbort("End of file reading %llu bytes (got %lld)", (unsigned long long)size, (long long)actualSize);
     cbuf += actualSize;
     size -= actualSize;
     }
 }
 
 void mustWriteFd(int fd, void *buf, size_t size)
 /* Write size bytes to file descriptor fd or die.  (See man 2 write.) */
 {
 ssize_t result = write(fd, buf, size);
 if (result < size)
-    errAbort("mustWriteFd: write failed: %s", strerror(errno));
+    {
+    if (result < 0)
+	errnoAbort("mustWriteFd: write failed");
+    else 
+        errAbort("mustWriteFd only wrote %lld of %lld bytes. Likely the disk is full.",
+	    (long long)result, (long long)size);
+    }
 }
 
 off_t mustLseek(int fd, off_t offset, int whence)
 /* Seek to given offset, relative to whence (see man lseek) in file descriptor fd or errAbort.
  * Return final offset (e.g. if this is just an (fd, 0, SEEK_CUR) query for current position). */
 {
 off_t ret = lseek(fd, offset, whence);
 if (ret < 0)
     errnoAbort("lseek(%d, %lld, %s (%d)) failed", fd, (long long)offset,
 	       ((whence == SEEK_SET) ? "SEEK_SET" : (whence == SEEK_CUR) ? "SEEK_CUR" :
 		(whence == SEEK_END) ? "SEEK_END" : "invalid 'whence' value"), whence);
 return ret;
 }
 
 void mustCloseFd(int *pFd)