From 85cbf4e0587ad8be8cc8867c9e65743316dd7ea3 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 29 Oct 2005 08:46:59 +0000 Subject: [PATCH] when giving a directory and other filesystem objects on the CLI, the fstool based applications (showattr, setattr, chxid) changed into this directory without going back. So the other objects can not be found anymore (resp. the wrong ones) [reported and patched by Daniel Hokka Zakrisson; http://savannah.nongnu.org/bugs/?func=detailitem&item_id=14313] git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2202 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/src/fstool.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util-vserver/src/fstool.c b/util-vserver/src/fstool.c index e5ceae2..e686f8c 100644 --- a/util-vserver/src/fstool.c +++ b/util-vserver/src/fstool.c @@ -156,8 +156,13 @@ processFile(char const *path) } if (S_ISDIR(st.st_mode) && !global_args->do_display_dir) { + int cur_dir = Eopen(".", O_RDONLY, 0); + uint64_t ret; Echdir(path); - return iterateFilesystem(path); + ret = iterateFilesystem(path); + Efchdir(cur_dir); + Eclose(cur_dir); + return ret; } else return handleFile(path, path) ? 0 : 1; -- 1.8.1.5