s3 onefs: Correctly error out when the read returns EOF
authorTim Prouty <tprouty@samba.org>
Wed, 18 Mar 2009 21:49:50 +0000 (21:49 +0000)
committerTim Prouty <tprouty@samba.org>
Wed, 18 Mar 2009 23:51:41 +0000 (16:51 -0700)
Also add some more debugging.

source3/modules/onefs_system.c

index b8b059bce9504737ae36924c6337ab21294ea92a..46f38265b1689de34f9c84e802c7f3bdcc2b740b 100644 (file)
@@ -591,8 +591,8 @@ ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
         */
        while (total_rbytes < count) {
 
-               DEBUG(0, ("shallow recvfile, reading %llu\n",
-                         count - total_rbytes));
+               DEBUG(0, ("shallow recvfile (%s), reading %llu\n",
+                         strerror(errno), count - total_rbytes));
 
                /*
                 * Read the remaining data into the spill buffer.  recvfile
@@ -603,9 +603,13 @@ ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
                               spill_buffer + (total_rbytes - total_wbytes),
                               count - total_rbytes);
 
-               if (ret == -1) {
-                       DEBUG(0, ("shallow recvfile read failed: %s\n",
-                                 strerror(errno)));
+               if (ret <= 0) {
+                       if (ret == 0) {
+                               DEBUG(0, ("shallow recvfile read: EOF\n"));
+                       } else {
+                               DEBUG(0, ("shallow recvfile read failed: %s\n",
+                                         strerror(errno)));
+                       }
                        /* Socket is dead, so treat as if it were drained. */
                        socket_drained = true;
                        goto out;