Commit Diff


commit - 8182bd343dfc2c182dd3ac5384515785d531bf2b
commit + e227880da6b6dbda2bf5abdb2156003ec64a733e
blob - 16847fa180829d337e301ad16215cee73b512e26
blob + e0e53c34d3bd7b4b8eda506a82b4b89c8ba4ef36
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -1629,7 +1629,8 @@ done:
 errored:
 	free(dir_test);
 	if (opened)
-		closedir(dt);
+		if (d && closedir(dt) == -1 && error == NULL)
+			error = got_error_from_errno("closedir");
 	return error;
 }
 
@@ -1687,7 +1688,8 @@ gw_load_got_paths(struct gw_trans *gw_trans)
 		}
 	}
 done:
-	closedir(d);
+	if (d && closedir(d) == -1 && error == NULL)
+		error = got_error_from_errno("closedir");
 	return error;
 }