| 1935 | } |
| 1936 | |
| 1937 | static void send_implied_dirs(int f, struct file_list *flist, char *fname, |
| 1938 | char *start, char *limit, int flags, char name_type) |
| 1939 | { |
| 1940 | static char lastpath[MAXPATHLEN] = ""; |
| 1941 | static int lastpath_len = 0; |
| 1942 | static struct file_struct *lastpath_struct = NULL; |
| 1943 | struct file_struct *file; |
| 1944 | item_list *relname_list; |
| 1945 | relnamecache **rnpp; |
| 1946 | int len, need_new_dir, depth = 0; |
| 1947 | filter_rule_list save_filter_list = filter_list; |
| 1948 | |
| 1949 | flags = (flags | FLAG_IMPLIED_DIR) & ~(FLAG_TOP_DIR | FLAG_CONTENT_DIR); |
| 1950 | filter_list.head = filter_list.tail = NULL; /* Don't filter implied dirs. */ |
| 1951 | |
| 1952 | if (inc_recurse) { |
| 1953 | if (lastpath_struct && F_PATHNAME(lastpath_struct) == pathname |
| 1954 | && lastpath_len == limit - fname |
| 1955 | && strncmp(lastpath, fname, lastpath_len) == 0) |
| 1956 | need_new_dir = 0; |
| 1957 | else |
| 1958 | need_new_dir = 1; |
| 1959 | } else { |
| 1960 | char *tp = fname, *lp = lastpath; |
| 1961 | /* Skip any initial directories in our path that we |
| 1962 | * have in common with lastpath. */ |
| 1963 | assert(start == fname); |
| 1964 | for ( ; ; tp++, lp++) { |
| 1965 | if (tp == limit) { |
| 1966 | if (*lp == '/' || *lp == '\0') |
| 1967 | goto done; |
| 1968 | break; |
| 1969 | } |
| 1970 | if (*lp != *tp) |
| 1971 | break; |
| 1972 | if (*tp == '/') { |
| 1973 | start = tp; |
| 1974 | depth++; |
| 1975 | } |
| 1976 | } |
| 1977 | need_new_dir = 1; |
| 1978 | } |
| 1979 | |
| 1980 | if (need_new_dir) { |
| 1981 | int save_copy_links = copy_links; |
| 1982 | int save_xfer_dirs = xfer_dirs; |
| 1983 | char *slash; |
| 1984 | |
| 1985 | copy_links = xfer_dirs = 1; |
| 1986 | |
| 1987 | *limit = '\0'; |
| 1988 | |
| 1989 | for (slash = start; (slash = strchr(slash+1, '/')) != NULL; ) { |
| 1990 | *slash = '\0'; |
| 1991 | file = send_file_name(f, flist, fname, NULL, flags, ALL_FILTERS); |
| 1992 | depth++; |
| 1993 | if (!inc_recurse && file && S_ISDIR(file->mode)) |
| 1994 | change_local_filter_dir(fname, strlen(fname), depth); |
no test coverage detected