2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-29 13:28:01 +00:00

read bug fix from Khali

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1557 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker 2002-10-11 23:48:15 +00:00
parent 138071ea37
commit 2e15825b48

View File

@ -644,7 +644,14 @@ static void dmi_table(int fd, u32 base, int len, int num)
struct dmi_header *dm;
u8 *data;
int i=0;
int r=0, r2=0;
if(len==0)
{
fputs("dmi: no data\n", stderr);
return;
}
if(buf==NULL)
{
perror("dmi: malloc");
@ -655,7 +662,9 @@ static void dmi_table(int fd, u32 base, int len, int num)
perror("dmi: lseek");
return;
}
if(read(fd, buf, len)!=len)
while(r2!=len && (r=read(fd, buf+r2, len-r2))!=0)
r2+=r;
if(r==0)
{
perror("dmi: read");
return;