From: Enrico Scholz Date: Sat, 29 Oct 2005 08:46:59 +0000 (+0000) Subject: when giving a directory and other filesystem objects on the CLI, the X-Git-Tag: version_0_30_210~79 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85cbf4e0587ad8be8cc8867c9e65743316dd7ea3;p=util-vserver.git 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 --- 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;