generator: Fix API of functions that return RBufferOut
[libguestfs.git] / fuse / guestmount.c
index ba0d626..baf2b66 100644 (file)
@@ -620,14 +620,8 @@ fg_read (const char *path, char *buf, size_t size, off_t offset,
   if (size > limit)
     size = limit;
 
-  /* Note the correct error handling here is tricky, because in the
-   * case where the call returns a zero-length buffer, it might return
-   * NULL.  However it won't adjust rsize along the error path, so we
-   * can set rsize to something beforehand and use that as a flag.
-   */
-  rsize = 1;
   r = guestfs_pread (g, path, size, offset, &rsize);
-  if (rsize == 1 && r == NULL)
+  if (r == NULL)
     return error ();
 
   /* This should never happen, but at least it stops us overflowing