autoconfig: don't call closedir() when opendir() failed
If opendir() fails, return from matchDriverFromFiles() immediately. Ubuntu bug 217647.
This commit is contained in:
parent
76381092e8
commit
fbad87f2ae
|
@ -330,7 +330,9 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
|
|||
int i, j;
|
||||
|
||||
idsdir = opendir(PCI_TXT_IDS_PATH);
|
||||
if (idsdir) {
|
||||
if (!idsdir)
|
||||
return;
|
||||
|
||||
xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", PCI_TXT_IDS_PATH);
|
||||
direntry = readdir(idsdir);
|
||||
/* Read the directory */
|
||||
|
@ -352,11 +354,11 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
|
|||
goto end;
|
||||
}
|
||||
/* Read the file */
|
||||
#ifdef __GLIBC__
|
||||
#ifdef __GLIBC__
|
||||
while ((read = getline(&line, &len, fp)) != -1) {
|
||||
#else
|
||||
#else
|
||||
while ((line = fgetln(fp, &len)) != (char *)NULL) {
|
||||
#endif /* __GLIBC __ */
|
||||
#endif /* __GLIBC __ */
|
||||
xchomp(line);
|
||||
if (isdigit(line[0])) {
|
||||
strncpy(vendor_str, line, 4);
|
||||
|
@ -408,7 +410,6 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
|
|||
}
|
||||
direntry = readdir(idsdir);
|
||||
}
|
||||
}
|
||||
end:
|
||||
xfree(line);
|
||||
closedir(idsdir);
|
||||
|
|
Loading…
Reference in New Issue