Minor improvements to chdir on browsing

- Don't do the chdir when working on an imported file; To keep with the
  spirit that ncdu doesn't attempt to correlate the imported fs with the
  actual fs.
- Call path_chdir() instead of chdir(), the former can handle infinitely
  long paths. (And, more pragmatically, doesn't generate a warning with
  -Wunused-result enabled).

(That said, path_chdir() is fairly inefficient and could use some
improvements)
This commit is contained in:
Yorhel 2017-01-06 18:45:02 +01:00
parent 20e1fbce46
commit d213ae3bb9

View file

@ -191,7 +191,8 @@ void dirlist_open(struct dir *d) {
/* not necessary for any ncdu functionality, /* not necessary for any ncdu functionality,
* but enables screen/tmux to work out our cwd */ * but enables screen/tmux to work out our cwd */
chdir(getpath(dirlist_par)); if(!dir_import_active)
path_chdir(getpath(dirlist_par));
/* set the head of the list */ /* set the head of the list */
head_real = head = d == NULL ? NULL : d->sub; head_real = head = d == NULL ? NULL : d->sub;