Skip to content
Snippets Groups Projects
Commit 21f2e627 authored by Yorhel's avatar Yorhel
Browse files

Removed another occurence of dirfd()

This fixes a tiny memory leak as well, as the return value of opendir()
wasn't passed to a closedir() after use.
parent e5dccc17
No related branches found
No related tags found
No related merge requests found
......@@ -212,10 +212,6 @@ char *path_real(const char *orig) {
int path_chdir(const char *path) {
char **arr, *cur;
int i, r = -1;
DIR *d;
if((d = opendir(".")) == NULL)
return -1;
if((cur = path_absolute(path)) == NULL)
return -1;
......@@ -229,8 +225,6 @@ int path_chdir(const char *path) {
r = 0;
path_chdir_done:
if(r < 0)
fchdir(dirfd(d));
free(cur);
free(arr);
return r;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment