summaryrefslogtreecommitdiff
path: root/src/mv.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-06-02 20:50:20 +0000
committerJim Meyering <jim@meyering.net>2002-06-02 20:50:20 +0000
commita4b18d89614bc970bd388571195295b454df3fcf (patch)
tree8057740d67a2b5031b21ea93095fc871b412b247 /src/mv.c
parentfb205872c1038139e118022014db0d6d817c34ec (diff)
downloadcoreutils-a4b18d89614bc970bd388571195295b454df3fcf.tar.xz
(do_move): Adapt to new calling sequence for rm.
Diffstat (limited to 'src/mv.c')
-rw-r--r--src/mv.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/mv.c b/src/mv.c
index 4fcebb80e..46aad167e 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -186,7 +186,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
if (!fail)
{
- const char *dir_to_remove;
+ char const *dir_to_remove;
if (copy_into_self)
{
/* In general, when copy returns with copy_into_self set, SOURCE is
@@ -239,40 +239,16 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
if (dir_to_remove != NULL)
{
struct rm_options rm_options;
- struct File_spec fs;
enum RM_status status;
- static int first_rm = 1;
- static struct dev_ino cwd_dev_ino;
-
- if (first_rm)
- {
- struct stat cwd_sb;
- if (lstat (".", &cwd_sb))
- error (EXIT_FAILURE, errno, _("cannot lstat `.'"));
-
- first_rm = 0;
- cwd_dev_ino.st_dev = cwd_sb.st_dev;
- cwd_dev_ino.st_ino = cwd_sb.st_ino;
- }
rm_option_init (&rm_options);
rm_options.verbose = x->verbose;
- remove_init ();
-
- fspec_init_file (&fs, dir_to_remove);
-
- /* Remove any trailing slashes. This is necessary if we
- took the else branch of movefile. */
- strip_trailing_slashes (fs.filename);
-
- status = rm (&fs, 1, &rm_options, &cwd_dev_ino);
+ status = rm (1, &dir_to_remove, &rm_options);
assert (VALID_STATUS (status));
if (status == RM_ERROR)
fail = 1;
- remove_fini ();
-
if (fail)
error (0, errno, _("cannot remove %s"), quote (dir_to_remove));
}