ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libeio/eio.c
(Generate patch)

Comparing cvsroot/libeio/eio.c (file contents):
Revision 1.51 by root, Thu Jan 7 18:08:21 2010 UTC vs.
Revision 1.53 by root, Sat Jan 9 10:03:09 2010 UTC

919 */ 919 */
920 { 920 {
921 off_t sbytes; 921 off_t sbytes;
922 res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); 922 res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0);
923 923
924 #if 0 /* according to the manpage, this is correct, but broken behaviour */
924 /* freebsd' sendfile will return 0 when success */ 925 /* freebsd' sendfile will return 0 on success */
925 if (res == 0 && sbytes) 926 /* freebsd 8 documents it as only setting *sbytes on EINTR and EAGAIN, but */
926 /* maybe only on EAGAIN: as usual, the manpage leaves you guessing */ 927 /* not on e.g. EIO or EPIPE - sounds broken */
928 if ((res < 0 && (errno == EAGAIN || errno == EINTR) && sbytes) || res == 0)
929 res = sbytes;
930 #endif
931
932 /* according to source inspection, this is correct, and useful behaviour */
933 if (sbytes)
927 res = sbytes; 934 res = sbytes;
928 } 935 }
929 936
930# elif defined (__APPLE__) 937# elif defined (__APPLE__)
931 938
932 { 939 {
933 off_t sbytes = count; 940 off_t sbytes = count;
934 res = sendfile (ifd, ofd, offset, &sbytes, 0, 0); 941 res = sendfile (ifd, ofd, offset, &sbytes, 0, 0);
935 942
936 if (res == 0 && errno == EAGAIN && sbytes) 943 /* according to the manpage, sbytes is always valid */
944 if (sbytes)
937 res = sbytes; 945 res = sbytes;
938 } 946 }
939 947
940# elif __hpux 948# elif __hpux
941 res = sendfile (ofd, ifd, offset, count, 0, 0); 949 res = sendfile (ofd, ifd, offset, count, 0, 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines