mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
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.
This commit is contained in:
parent
e5dccc1719
commit
21f2e62793
1 changed files with 0 additions and 6 deletions
|
|
@ -212,10 +212,6 @@ char *path_real(const char *orig) {
|
||||||
int path_chdir(const char *path) {
|
int path_chdir(const char *path) {
|
||||||
char **arr, *cur;
|
char **arr, *cur;
|
||||||
int i, r = -1;
|
int i, r = -1;
|
||||||
DIR *d;
|
|
||||||
|
|
||||||
if((d = opendir(".")) == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if((cur = path_absolute(path)) == NULL)
|
if((cur = path_absolute(path)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -229,8 +225,6 @@ int path_chdir(const char *path) {
|
||||||
r = 0;
|
r = 0;
|
||||||
|
|
||||||
path_chdir_done:
|
path_chdir_done:
|
||||||
if(r < 0)
|
|
||||||
fchdir(dirfd(d));
|
|
||||||
free(cur);
|
free(cur);
|
||||||
free(arr);
|
free(arr);
|
||||||
return r;
|
return r;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue