char*bufptr;/* Next buffer location to read into */
intbytesleft;/* Number of bytes of .data left to read */
intbytesread;/* Total number of bytes read */
bvdbg("Read %d bytes from offset %d\n",readsize,offset);
bvdbg("Read %ld bytes from offset %ld\n",(long)readsize,(long)offset);
/* Seek to the position in the object file where the initialized
*dataissaved.
*/
/* Loop until all of the requested data has been read. */
bytesread=0;
bufptr=buffer;
bytesleft=readsize;
do
while(readsize>0)
{
/* Seek to the next read position */
rpos=lseek(loadinfo->filfd,offset,SEEK_SET);
if(rpos!=offset)
{
bdbg("Failed to seek to position %d: %d\n",offset,errno);
return-errno;
interrval=errno;
bdbg("Failed to seek to position %ld: %d\n",(long)offset,errval);
return-errval;
}
/* Read the file data at offset into the user buffer */
nbytes=read(loadinfo->filfd,bufptr,bytesleft);
nbytes=read(loadinfo->filfd,buffer,readsize);
if(nbytes<0)
{
if(errno!=EINTR)
interrval=errno;
/* EINTR just means that we received a signal */
if(errval!=EINTR)
{
bdbg("Read of .data failed: %d\n",errno);
return-errno;
bdbg("Read of .data failed: %d\n",errval);
return-errval;
}
}
elseif(nbytes==0)
@ -150,15 +150,12 @@ int elf_read(struct elf_loadinfo_s *loadinfo, char *buffer, int readsize, int of
@@ -150,15 +150,12 @@ int elf_read(struct elf_loadinfo_s *loadinfo, char *buffer, int readsize, int of