- /* due to the nature of afp packets, we have to exit if we get
- an error. we can't do this with translation on. */
-#ifdef WITH_SENDFILE
- if (!(xlate)) {
- int fd;
-
- fd = ad_readfile_init(ofork->of_ad, eid, &offset, 0);
-
- if (dsi_stream_read_file(dsi, fd, offset, dsi->datasize) < 0) {
- if (errno == EINVAL || errno == ENOSYS)
- goto afp_read_loop;
- else {
- LOG(log_error, logtype_afpd, "afp_read(%s): ad_readfile: %s", of_name(ofork), strerror(errno));
- goto afp_read_exit;
- }
- }
-
- dsi_readdone(dsi);
- goto afp_read_done;
- }
-
- afp_read_loop:
-#endif
-
- /* fill up our buffer. */
- while (*rbuflen > 0) {
- cc = read_file(ofork, eid, offset, nlmask, nlchar, rbuf,rbuflen, xlate);
- if (cc < 0)
- goto afp_read_exit;
-
- offset += *rbuflen;
- /* dsi_read() also returns buffer size of next allocation */
- cc = dsi_read(dsi, rbuf, *rbuflen); /* send it off */
- if (cc < 0)
- goto afp_read_exit;
- *rbuflen = cc;
- }
- dsi_readdone(dsi);
- goto afp_read_done;
-
- afp_read_exit:
- LOG(log_error, logtype_afpd, "afp_read(%s): %s", of_name(ofork), strerror(errno));
- dsi_readdone(dsi);
- ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff, savereqcount,ofork->of_refnum);
- obj->exit(EXITERR_CLNT);