* a problem. much confusion results otherwise. */
while (*rbuflen > 0) {
#ifdef WITH_SENDFILE
- if (!obj->options.flags & OPTION_DEBUG) {
- if (dsi_stream_read_file(dsi, si.sdt_fd, offset, dsi->datasize) < 0) {
- switch (errno) {
- case ENOSYS:
- case EINVAL: /* there's no guarantee that all fs support sendfile */
- break;
- default:
- goto geticon_exit;
- }
- }
- else {
- dsi_readdone(dsi);
- return AFP_OK;
+ if (dsi_stream_read_file(dsi, si.sdt_fd, offset, dsi->datasize) < 0) {
+ switch (errno) {
+ case ENOSYS:
+ case EINVAL: /* there's no guarantee that all fs support sendfile */
+ break;
+ default:
+ goto geticon_exit;
}
}
+ else {
+ dsi_readdone(dsi);
+ return AFP_OK;
+ }
#endif
buflen = read(si.sdt_fd, rbuf, *rbuflen);
if (buflen < 0)
offset += cc;
#if 0 /*def HAVE_SENDFILE_WRITE*/
- if (!(obj->options.flags & OPTION_DEBUG)) {
- if ((cc = ad_writefile(ofork->of_ad, eid, dsi->socket,
- offset, dsi->datasize)) < 0) {
- switch (errno) {
- case EDQUOT :
- case EFBIG :
- case ENOSPC :
- cc = AFPERR_DFULL;
- break;
- default :
- LOG(log_error, logtype_afpd, "afp_write: ad_writefile: %s", strerror(errno) );
- goto afp_write_loop;
- }
- dsi_writeflush(dsi);
- *rbuflen = 0;
- ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff,
- reqcount, ofork->of_refnum);
- return cc;
+ if ((cc = ad_writefile(ofork->of_ad, eid, dsi->socket,
+ offset, dsi->datasize)) < 0) {
+ switch (errno) {
+ case EDQUOT:
+ case EFBIG:
+ case ENOSPC:
+ cc = AFPERR_DFULL;
+ break;
+ default:
+ LOG(log_error, logtype_afpd, "afp_write: ad_writefile: %s", strerror(errno) );
+ goto afp_write_loop;
}
-
- offset += cc;
- goto afp_write_done;
+ dsi_writeflush(dsi);
+ *rbuflen = 0;
+ ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff,
+ reqcount, ofork->of_refnum);
+ return cc;
}
+
+ offset += cc;
+ goto afp_write_done;
#endif /* 0, was HAVE_SENDFILE_WRITE */
/* loop until everything gets written. currently