]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(copy_internal): Move the one-file-system test so that
authorJim Meyering <jim@meyering.net>
Fri, 30 Apr 1999 15:40:34 +0000 (15:40 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 30 Apr 1999 15:40:34 +0000 (15:40 +0000)
it follows the `if (new_dst || !S_ISDIR (dst_sb.st_mode))' block.
Prior to this change, `cp --one-file-system' would traverse a file-
system boundary if the destination directory existed.
From thospel@mail.dma.be.

src/copy.c

index 726ed8bd3b4a8a4319ddbd7fa6f55468ed247219..fe68d49f48d65e7b1ce4485d090a6f1bd511ca30 100644 (file)
@@ -696,12 +696,12 @@ copy_internal (const char *src_path, const char *dst_path,
 
          if (x->verbose)
            printf ("%s -> %s\n", src_path, dst_path);
-
-         /* Are we crossing a file system boundary?  */
-         if (x->one_file_system && device != 0 && device != src_sb.st_dev)
-           return 0;
        }
 
+      /* Are we crossing a file system boundary?  */
+      if (x->one_file_system && device != 0 && device != src_sb.st_dev)
+       return 0;
+
       /* Copy the contents of the directory.  */
 
       if (copy_dir (src_path, dst_path, new_dst, &src_sb, dir, x,