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);
if (dirp != NULL) {
r = closedir(dirp); r = closedir(dirp);
if (r == -1) if (r == -1)
printerr(1, "closedir"); printerr(1, "closedir");
}
goto begin; goto begin;
} }