aux/vga: pci.c dircount bug 2

This commit is contained in:
cinap_lenrek 2011-05-23 23:12:30 +00:00
parent 8987674d48
commit 9a1a927377

View file

@ -27,10 +27,6 @@ pcicfginit(void)
for(i=0; i<n; i++) {
if(strstr(d[i].name, "ctl") == nil)
continue;
if((j = strlen(d[i].name)-3) < 5)
continue;
sprint(buf, "%.*s", j, d[i].name);
bno = strtoul(buf, &s, 10);
dno = strtoul(s+1, &s, 10);
@ -40,19 +36,16 @@ pcicfginit(void)
p->tbdf = MKBUS(BusPCI, bno, dno, fno);
sprint(buf, "%s/%d.%d.%draw", base, bno, dno, fno);
if((p->rawfd = open(buf, ORDWR)) < 0){
fprint(2, "raw: %r\n");
free(p);
continue;
}
sprint(buf, "%s/%d.%d.%dctl", base, bno, dno, fno);
if((fd = open(buf, OREAD)) < 0){
fprint(2, "ctl: %r\n");
close(p->rawfd);
free(p);
continue;
}
if((j = read(fd, buf, sizeof(buf)-1)) <= 0){
fprint(2, "read: %r\n");
close(p->rawfd);
close(fd);
free(p);