OSDN Git Service

Fix directory test in cp.
authorElliott Hughes <enh@google.com>
Wed, 6 Jan 2016 16:38:46 +0000 (08:38 -0800)
committerRob Landley <rob@landley.net>
Tue, 2 Feb 2016 05:03:35 +0000 (23:03 -0600)
Commit 3d33dd80f8cb931e293d7f64c44bc357fec11120 fixed a use of S_ISDIR
on st_dev rather than st_mode in find, but there was another instance
of the same error in cp.

toys/posix/cp.c

index f932ca4..cb7e6e3 100644 (file)
@@ -177,7 +177,7 @@ int cp_node(struct dirtree *try)
     if (!faccessat(cfd, catch, F_OK, 0) && !S_ISDIR(cst.st_mode)) {
       char *s;
 
-      if (S_ISDIR(try->st.st_dev)) {
+      if (S_ISDIR(try->st.st_mode)) {
         error_msg("dir at '%s'", s = dirtree_path(try, 0));
         free(s);
         return 0;