Correct my patch of 2004-10-18.

(rm): Destroy the saved_cwd here (via cwd_state),
if necessary, not in remove_dir.  Otherwise, removing multiple
`.'-relative nonempty directories no longer worked.
This commit is contained in:
Jim Meyering committed 2004-10-21 10:37:18 +00:00
1 parent 0f8445ab90
commit 2469a229d5
1 file changed
+4 -4
+4 -4
View File
@@ -1151,10 +1151,7 @@ remove_dir (Dirstack_state *ds, char const *dir, struct cwd_state **cwd_state,
free (empty_dir);
if (AD_stack_height (ds) == 1)
{
free_cwd (&AD_stack_top(ds)->u.saved_cwd);
break;
}
break;
}
}
@@ -1235,6 +1232,9 @@ rm (size_t n_files, char const *const *file, struct rm_options const *x)
ds_free (ds);
if (cwd_state && cwd_state->saved_errno == 0)
free_cwd (&cwd_state->saved_cwd);
free (cwd_state);
return status;