int euidaccess ();
int yesno ();
+int lstat ();
+
static int copy_internal PARAMS ((const char *src_path, const char *dst_path,
int new_dst, dev_t device,
struct dir_list *ancestors,
{
char *name_space;
char *namep;
+ struct cp_options non_command_line_options = *x;
int ret = 0;
name_space = savedir (src_path_in, src_sb->st_size);
return -1;
}
+ /* For cp's -H option, dereference command line arguments, but do not
+ dereference symlinks that are found via recursive traversal. */
+ if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)
+ non_command_line_options.xstat = lstat;
+
namep = name_space;
while (*namep != '\0')
{
xalloc_die ();
ret |= copy_internal (src_path, dst_path, new_dst, src_sb->st_dev,
- ancestors, x, 0, &local_copy_into_self, NULL);
+ ancestors, &non_command_line_options, 0,
+ &local_copy_into_self, NULL);
*copy_into_self |= local_copy_into_self;
/* Free the memory for `src_path'. The memory for `dst_path'
|| (x->hard_link
&& S_ISLNK (src_sb.st_mode)
&& !S_ISLNK (dst_sb.st_mode)))
- && !x->dereference
+ && x->dereference == DEREF_NEVER
&& (S_ISLNK (dst_sb.st_mode) ^ S_ISLNK (src_sb.st_mode)))
{
struct stat dst2_sb;
/* Did we copy this inode somewhere else (in this command line argument)
and therefore this is a second hard link to the inode? */
- if (!x->dereference && src_sb.st_nlink > 1 && earlier_file)
+ if (x->dereference == DEREF_NEVER && src_sb.st_nlink > 1 && earlier_file)
{
/* Avoid damaging the destination filesystem by refusing to preserve
hard-linked directories (which are found at least in Netapp snapshot