Revert part of revision 1.74 after bde reminded me of a detail I'd

forgotten about how sysctl works.  This removes a potential (though
not very likely) race that 1.74 introduced.
This commit is contained in:
Dag-Erling Smørgrav 2003-12-11 07:46:08 +00:00
parent 165d50f626
commit 56f9b09632

View File

@ -852,10 +852,13 @@ dointr(void)
kread(X_INTRCNT, intrcnt, intrcntlen);
kread(X_INTRNAMES, intrname, inamlen);
} else {
mysysctl("hw.intrcnt", NULL, &intrcntlen, NULL, 0);
if ((intrcnt = malloc(intrcntlen)) == NULL)
err(1, "calloc()");
mysysctl("hw.intrcnt", intrcnt, &intrcntlen, NULL, 0);
for (intrcnt = NULL, intrcntlen = 1024; ; intrcntlen *= 2) {
if ((intrcnt = reallocf(intrcnt, intrcntlen)) == NULL)
err(1, "reallocf()");
if (mysysctl("hw.intrcnt",
intrcnt, &intrcntlen, NULL, 0) == 0)
break;
}
for (intrname = NULL, inamlen = 1024; ; inamlen *= 2) {
if ((intrname = reallocf(intrname, inamlen)) == NULL)
err(1, "reallocf()");