MCPcopy Index your code
hub / github.com/RsyncProject/rsync / do_server_sender

Function do_server_sender

main.c:926–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

924}
925
926static void do_server_sender(int f_in, int f_out, int argc, char *argv[])
927{
928 struct file_list *flist;
929 char *dir;
930
931 if (DEBUG_GTE(SEND, 1))
932 rprintf(FINFO, "server_sender starting pid=%d\n", (int)getpid());
933
934 if (am_daemon && lp_write_only(module_id)) {
935 rprintf(FERROR, "ERROR: module is write only\n");
936 exit_cleanup(RERR_SYNTAX);
937 }
938 if (am_daemon && read_only && remove_source_files) {
939 rprintf(FERROR,
940 "ERROR: --remove-%s-files cannot be used with a read-only module\n",
941 remove_source_files == 1 ? "source" : "sent");
942 exit_cleanup(RERR_SYNTAX);
943 }
944 if (argc < 1) {
945 rprintf(FERROR, "ERROR: do_server_sender called without args\n");
946 exit_cleanup(RERR_SYNTAX);
947 }
948
949 become_copy_as_user();
950
951 dir = argv[0];
952 if (!relative_paths) {
953 if (!change_dir(dir, CD_NORMAL)) {
954 rsyserr(FERROR, errno, "change_dir#3 %s failed",
955 full_fname(dir));
956 exit_cleanup(RERR_FILESELECT);
957 }
958 }
959 argc--;
960 argv++;
961
962 if (argc == 0 && (recurse || xfer_dirs || list_only)) {
963 argc = 1;
964 argv--;
965 argv[0] = ".";
966 }
967
968 flist = send_file_list(f_out,argc,argv);
969 if (!flist || flist->used == 0) {
970 /* Make sure input buffering is off so we can't hang in noop_io_until_death(). */
971 io_end_buffering_in(0);
972 /* TODO: we should really exit in a more controlled manner. */
973 exit_cleanup(0);
974 }
975
976 io_start_buffering_in(f_in);
977
978 send_files(f_in, f_out);
979 io_flush(FULL_FLUSH);
980 handle_stats(f_out);
981 if (protocol_version >= 24)
982 read_final_goodbye(f_in, f_out);
983 io_flush(FULL_FLUSH);

Callers 1

start_serverFunction · 0.85

Calls 12

become_copy_as_userFunction · 0.85
change_dirFunction · 0.85
full_fnameFunction · 0.85
send_file_listFunction · 0.85
io_end_buffering_inFunction · 0.85
io_start_buffering_inFunction · 0.85
send_filesFunction · 0.85
io_flushFunction · 0.85
handle_statsFunction · 0.85
read_final_goodbyeFunction · 0.85
rprintfFunction · 0.70
rsyserrFunction · 0.70

Tested by

no test coverage detected