closedir only after finishing use of any results from readdir

This commit is contained in:
Pierre Willenbrock 2008-12-15 09:08:30 +08:00 committed by Zhenyu Wang
parent 865735d840
commit d917583c19
1 changed files with 2 additions and 1 deletions

View File

@ -422,7 +422,6 @@ i830_lvds_acpi_lid_open(xf86OutputPtr output)
}
if (strcmp(lid_dent->d_name, ".") &&
strcmp(lid_dent->d_name, "..")) {
closedir(lid_dir);
break;
}
}
@ -432,6 +431,8 @@ i830_lvds_acpi_lid_open(xf86OutputPtr output)
strcat(state_name, lid_dent->d_name);
strcat(state_name, "/state");
closedir(lid_dir);
if ((fd = open(state_name, O_RDONLY)) == -1) {
free(state_name);
goto out;