summaryrefslogtreecommitdiff
path: root/lib/rename.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-05-13 13:19:07 +0000
committerJim Meyering <jim@meyering.net>1995-05-13 13:19:07 +0000
commiteec5824b1abea623b535e322d4d20594ccf2c245 (patch)
tree4d524bb62ddf2a1e74425357e8df69c0df80ca79 /lib/rename.c
parentb3fc4e375fc65173e40a35a3e9168e1668c38ba4 (diff)
downloadcoreutils-eec5824b1abea623b535e322d4d20594ccf2c245.tar.xz
(rename): Use stat, not safe_stat.
(rename): Compare src and dest inode numbers rather than src inode and dest *dev* when determining whether src and dest refer to the same file. From marc@math.cornell.edu (Marc Parmet).
Diffstat (limited to 'lib/rename.c')
-rw-r--r--lib/rename.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rename.c b/lib/rename.c
index 4759508b3..a87ff19b4 100644
--- a/lib/rename.c
+++ b/lib/rename.c
@@ -47,13 +47,13 @@ rename (from, to)
struct stat from_stats, to_stats;
int pid, status;
- if (safe_stat (from, &from_stats))
+ if (stat (from, &from_stats))
return -1;
/* Be careful not to unlink `from' if it happens to be equal to `to' or
(on filesystems that silently truncate filenames after 14 characters)
if `from' and `to' share the significant characters. */
- if (safe_stat (to, &to_stats))
+ if (stat (to, &to_stats))
{
if (errno != ENOENT)
return -1;
@@ -61,7 +61,7 @@ rename (from, to)
else
{
if ((from_stats.st_dev == to_stats.st_dev)
- && (from_stats.st_ino == to_stats.st_dev))
+ && (from_stats.st_ino == to_stats.st_ino))
/* `from' and `to' designate the same file on that filesystem. */
return 0;