mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(remove_dir): If we can't save the state of the
working directory, pretend we started from "/", not ".". This avoids a bug on hosts like Solaris that don't let you remove the working directory.
This commit is contained in:
1 parent
02b3090917
commit
5bfb177670
1 file changed
+6
-3
+6
-3
@@ -1008,9 +1008,12 @@ remove_dir (Dirstack_state *ds, char const *dir, struct cwd_state **cwd_state,
|
||||
(*cwd_state)->saved_errno = errno;
|
||||
assert (errno != 0);
|
||||
|
||||
/* Pretend we started from ".". That is fine as long as there
|
||||
is no requirement to return to the original working directory. */
|
||||
(*cwd_state)->saved_cwd.name = xstrdup (".");
|
||||
/* Pretend we started from "/". That is fine as long as there
|
||||
is no requirement to return to the original working directory.
|
||||
Use "/", not ".", so that we chdir out of a non-root target
|
||||
directory before attempting to remove it: some hosts don't let
|
||||
you remove a working directory. */
|
||||
(*cwd_state)->saved_cwd.name = xstrdup ("/");
|
||||
}
|
||||
else
|
||||
(*cwd_state)->saved_errno = 0;
|
||||
|
||||
Reference in new issue
Block a user