summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-01-11 03:22:50 +0000
committerJim Meyering <jim@meyering.net>1999-01-11 03:22:50 +0000
commit0e777744cb2ecda089860b67e9e97d80204780ab (patch)
tree5521423f84052640b16036738c16faaa07a395f9 /src
parent9a887e5ca4ae8f692879e892c0fe0d50766941bc (diff)
downloadcoreutils-0e777744cb2ecda089860b67e9e97d80204780ab.tar.xz
(copy_internal): Handle two more values of errno from
failed rename of a directory into a subdirectory of itself.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/copy.c b/src/copy.c
index 4b50d10f7..fd1bee4f3 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1,5 +1,5 @@
/* copy.c -- core functions for copying files and directories
- Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation.
+ Copyright (C) 89, 90, 91, 95, 96, 97, 1998, 1999 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -625,14 +625,28 @@ copy_internal (const char *src_path, const char *dst_path,
/* This happens when attempting to rename a directory to a
subdirectory of itself. */
- if (errno == EINVAL)
+ if (errno == EINVAL
+
+ /* When src_path is on an NFS file system, some types of
+ clients, e.g., SunOS4.1.4 and IRIX-5.3, set errno to EIO
+ instead. Testing for this here risks misinterpreting a real
+ I/O error as an attempt to move a directory into itself, so
+ FIXME: consider not doing this. */
+ || errno == EIO
+
+ /* And with SunOS-4.1.4 client and OpenBSD-2.3 server,
+ we get ENOTEMPTY. */
+ || errno == ENOTEMPTY)
{
/* FIXME: this is a little fragile in that it relies on rename(2)
- returning a specific errno (EINVAL). Expect problems on
+ failing with a specific errno value. Expect problems on
non-POSIX systems. */
*copy_into_self = 1;
return 0;
}
+
+ /* Ignore other types of failure (e.g. EXDEV), since the following
+ code will try to perform a copy, then remove. */
}
if (S_ISDIR (src_type))