summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-03-17 16:00:54 +0000
committerJim Meyering <jim@meyering.net>2002-03-17 16:00:54 +0000
commitb3354081aca2aaa16b878c576a2fd119df2fe0fa (patch)
treee349037f49e8f3a3cd912b0974a2a80414276d7a /src
parentaedb44867d0732f586ca97ef10a7b194911904ca (diff)
downloadcoreutils-b3354081aca2aaa16b878c576a2fd119df2fe0fa.tar.xz
(copy_internal) [move_mode]: Give a better diagnostic
(using errno from the failed unlink) when a cross-device `mv' fails, e.g., because the destination cannot be unlinked. Prompted by a report from Karl Berry.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/copy.c b/src/copy.c
index 017adf8d2..f9ad0a388 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -791,7 +791,6 @@ copy_internal (const char *src_path, const char *dst_path,
char *earlier_file = NULL;
char *dst_backup = NULL;
int backup_succeeded = 0;
- int rename_errno;
int delayed_fail;
int copied_as_regular = 0;
int ran_chown = 0;
@@ -1213,16 +1212,14 @@ copy_internal (const char *src_path, const char *dst_path,
return 1;
}
- /* Save this value of errno to use in case the unlink fails. */
- rename_errno = errno;
-
/* The rename attempt has failed. Remove any existing destination
file so that a cross-device `mv' acts as if it were really using
the rename syscall. */
if (unlink (dst_path) && errno != ENOENT)
{
/* Use the value of errno from the failed rename. */
- error (0, rename_errno, _("cannot move %s to %s"),
+ error (0, errno,
+ _("inter-device move failed: %s to %s; unable to remove target"),
quote_n (0, src_path), quote_n (1, dst_path));
return 1;
}