Only closedir when dirp is valid

This commit is contained in:
sin 2014-10-10 10:12:01 +01:00
parent bc2d9e7c11
commit 61cd0f8041

View file

@ -552,9 +552,11 @@ out:
free(dents[i].name); free(dents[i].name);
free(dents); free(dents);
r = closedir(dirp); if (dirp != NULL) {
if (r == -1) r = closedir(dirp);
printerr(1, "closedir"); if (r == -1)
printerr(1, "closedir");
}
goto begin; goto begin;
} }