MCPcopy Create free account
hub / github.com/RsyncProject/rsync / get_dirlist

Function get_dirlist

flist.c:3419–3458  ·  view source on GitHub ↗

Do a non-recursive scan of the named directory, possibly ignoring all * exclude rules except for the daemon's. If "dlen" is >=0, it is the length * of the dirname string, and also indicates that "dirname" is a MAXPATHLEN * buffer (the functions we call will append names onto the end, but the old * dir value will be restored on exit). */

Source from the content-addressed store, hash-verified

3417 * buffer (the functions we call will append names onto the end, but the old
3418 * dir value will be restored on exit). */
3419struct file_list *get_dirlist(char *dirname, int dlen, int flags)
3420{
3421 struct file_list *dirlist;
3422 char dirbuf[MAXPATHLEN];
3423 int save_recurse = recurse;
3424 int save_xfer_dirs = xfer_dirs;
3425 int save_prune_empty_dirs = prune_empty_dirs;
3426 int senddir_fd = flags & GDL_IGNORE_FILTER_RULES ? -2 : -1;
3427 int senddir_flags = FLAG_CONTENT_DIR;
3428
3429 if (dlen < 0) {
3430 dlen = strlcpy(dirbuf, dirname, MAXPATHLEN);
3431 if (dlen >= MAXPATHLEN)
3432 return NULL;
3433 dirname = dirbuf;
3434 }
3435
3436 dirlist = flist_new(FLIST_TEMP, "get_dirlist");
3437
3438 if (flags & GDL_PERHAPS_DIR)
3439 senddir_flags |= FLAG_PERHAPS_DIR;
3440
3441 recurse = 0;
3442 xfer_dirs = 1;
3443 send_directory(senddir_fd, dirlist, dirname, dlen, senddir_flags);
3444 xfer_dirs = save_xfer_dirs;
3445 recurse = save_recurse;
3446 if (INFO_GTE(PROGRESS, 1))
3447 flist_count_offset += dirlist->used;
3448
3449 prune_empty_dirs = 0;
3450 dirlist->sorted = dirlist->files;
3451 flist_sort_and_clean(dirlist, 0);
3452 prune_empty_dirs = save_prune_empty_dirs;
3453
3454 if (DEBUG_GTE(FLIST, 3))
3455 output_flist(dirlist);
3456
3457 return dirlist;
3458}

Callers 3

delete_in_dirFunction · 0.85
recv_generatorFunction · 0.85
delete_dir_contentsFunction · 0.85

Calls 5

strlcpyFunction · 0.85
flist_newFunction · 0.85
send_directoryFunction · 0.85
flist_sort_and_cleanFunction · 0.85
output_flistFunction · 0.85

Tested by

no test coverage detected