[BACK]Return to scp.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/scp.c between version 1.248 and 1.249

version 1.248, 2022/05/13 06:31:50 version 1.249, 2022/10/24 21:51:55
Line 1474 
Line 1474 
         }          }
   
         debug3_f("copying remote %s to local %s", abs_src, dst);          debug3_f("copying remote %s to local %s", abs_src, dst);
         if ((r = remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) {          if ((r = remote_glob(conn, abs_src, GLOB_NOCHECK|GLOB_MARK,
               NULL, &g)) != 0) {
                 if (r == GLOB_NOSPACE)                  if (r == GLOB_NOSPACE)
                         error("%s: too many glob matches", src);                          error("%s: too many glob matches", src);
                 else                  else
Line 1483 
Line 1484 
                 goto out;                  goto out;
         }          }
   
           /* Did we actually get any matches back from the glob? */
           if (g.gl_matchc == 0 && g.gl_pathc == 1 && g.gl_pathv[0] != 0) {
                   /*
                    * If nothing matched but a path returned, then it's probably
                    * a GLOB_NOCHECK result. Check whether the unglobbed path
                    * exists so we can give a nice error message early.
                    */
                   if (do_stat(conn, g.gl_pathv[0], 1) == NULL) {
                           error("%s: %s", src, strerror(ENOENT));
                           err = -1;
                           goto out;
                   }
           }
   
         if ((r = stat(dst, &st)) != 0)          if ((r = stat(dst, &st)) != 0)
                 debug2_f("stat local \"%s\": %s", dst, strerror(errno));                  debug2_f("stat local \"%s\": %s", dst, strerror(errno));
         dst_is_dir = r == 0 && S_ISDIR(st.st_mode);          dst_is_dir = r == 0 && S_ISDIR(st.st_mode);
Line 1700 
Line 1715 
                 }                  }
                 if (npatterns > 0) {                  if (npatterns > 0) {
                         for (n = 0; n < npatterns; n++) {                          for (n = 0; n < npatterns; n++) {
                                 if (fnmatch(patterns[n], cp, 0) == 0)                                  if (strcmp(patterns[n], cp) == 0 ||
                                       fnmatch(patterns[n], cp, 0) == 0)
                                         break;                                          break;
                         }                          }
                         if (n >= npatterns)                          if (n >= npatterns)
Line 1883 
Line 1899 
         }          }
   
         debug3_f("copying remote %s to remote %s", abs_src, target);          debug3_f("copying remote %s to remote %s", abs_src, target);
         if ((r = remote_glob(from, abs_src, GLOB_MARK, NULL, &g)) != 0) {          if ((r = remote_glob(from, abs_src, GLOB_NOCHECK|GLOB_MARK,
               NULL, &g)) != 0) {
                 if (r == GLOB_NOSPACE)                  if (r == GLOB_NOSPACE)
                         error("%s: too many glob matches", src);                          error("%s: too many glob matches", src);
                 else                  else
                         error("%s: %s", src, strerror(ENOENT));                          error("%s: %s", src, strerror(ENOENT));
                 err = -1;                  err = -1;
                 goto out;                  goto out;
           }
   
           /* Did we actually get any matches back from the glob? */
           if (g.gl_matchc == 0 && g.gl_pathc == 1 && g.gl_pathv[0] != 0) {
                   /*
                    * If nothing matched but a path returned, then it's probably
                    * a GLOB_NOCHECK result. Check whether the unglobbed path
                    * exists so we can give a nice error message early.
                    */
                   if (do_stat(from, g.gl_pathv[0], 1) == NULL) {
                           error("%s: %s", src, strerror(ENOENT));
                           err = -1;
                           goto out;
                   }
         }          }
   
         for (i = 0; g.gl_pathv[i] && !interrupted; i++) {          for (i = 0; g.gl_pathv[i] && !interrupted; i++) {

Legend:
Removed from v.1.248  
changed lines
  Added in v.1.249