summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-01-06 18:45:02 +0100
committerYorhel <git@yorhel.nl>2017-01-06 18:48:47 +0100
commitd213ae3bb9c727dda1b48aac0f058ae5201d2a72 (patch)
tree1d05a4e371ecac0f3a6aaab6e2a7b768069628a9
parent20e1fbce46619cad3bebd5cb09ac9dcef978b936 (diff)
Minor improvements to chdir on browsingchdir
- 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)
-rw-r--r--src/dirlist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dirlist.c b/src/dirlist.c
index 8765503..b26ba84 100644
--- a/src/dirlist.c
+++ b/src/dirlist.c
@@ -191,7 +191,8 @@ void dirlist_open(struct dir *d) {
/* not necessary for any ncdu functionality,
* 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 */
head_real = head = d == NULL ? NULL : d->sub;