- if (( cc = adf_pread( &ad->ad_resource_fork, buf, buflen, r_off )) < 0 )
- return( -1 );
- /*
- * We've just read in bytes from the disk that we read earlier
- * into ad_data. If we're going to write this buffer out later,
- * we need to update ad_data.
- * FIXME : always false?
- */
- if (r_off < ad_getentryoff(ad, ADEID_RFORK)) {
- if ( ad->ad_resource_fork.adf_flags & O_RDWR ) {
- memcpy(buf, ad->ad_data + r_off,
- MIN(sizeof( ad->ad_data ) - r_off, cc));
- } else {
- memcpy(ad->ad_data + r_off, buf,
- MIN(sizeof( ad->ad_data ) - r_off, cc));
- }
- }
- } else { /* AD_VERSION_EA */
- if ((off + buflen) > ad->ad_rlen) {
- errno = ERANGE;
- return -1;
- }
- memcpy(buf, ad->ad_resforkbuf + off, buflen);
- cc = buflen;