summaryrefslogtreecommitdiff
path: root/src/cp-hash.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-01-10 11:54:53 +0000
committerJim Meyering <jim@meyering.net>2001-01-10 11:54:53 +0000
commitb6e29912beb5343916d20e21fa1bb45628a0dfbf (patch)
tree7163229fb2c56c62d4297d03b16d0b136517fd0b /src/cp-hash.c
parent687ef9f9fe9bd71c54826616753c2007dbb885b6 (diff)
downloadcoreutils-b6e29912beb5343916d20e21fa1bb45628a0dfbf.tar.xz
[struct entry] (node): Describe how it's used,
now that we've overloaded it a little, in order to detect and diagnose the copying-directory-into-self problem. (new_file): Remove global. (htab): Declare global to be static. (remember_created): Insert file name instead of dummy pointer, so that copy.c can use the just-created directory name to detect the copying-directory-into-self problem.
Diffstat (limited to 'src/cp-hash.c')
-rw-r--r--src/cp-hash.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cp-hash.c b/src/cp-hash.c
index 6658ca169..a064efcae 100644
--- a/src/cp-hash.c
+++ b/src/cp-hash.c
@@ -1,5 +1,5 @@
/* cp-hash.c -- file copying (hash search routines)
- Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
+ Copyright (C) 89, 90, 91, 1995-2001 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
@@ -33,7 +33,11 @@ struct entry
{
ino_t ino;
dev_t dev;
- char *node; /* Path name, or &new_file for new inodes. */
+ /* Destination path name (of non-directory or pre-existing directory)
+ corresponding to the dev/ino of a copied file, or the destination path
+ name corresponding to a dev/ino pair for a newly-created directory. */
+ char *node;
+
struct entry *coll_link; /* 0 = entry not occupied. */
};
@@ -46,8 +50,7 @@ struct htab
struct entry *hash[1]; /* Vector of pointers in `entry_tab'. */
};
-struct htab *htab;
-char new_file;
+static struct htab *htab;
static char *cph_hash_insert PARAMS ((ino_t ino, dev_t dev, const char *node));
@@ -65,7 +68,7 @@ remember_created (const char *path)
return 1;
}
- cph_hash_insert (sb.st_ino, sb.st_dev, &new_file);
+ cph_hash_insert (sb.st_ino, sb.st_dev, path);
return 0;
}