This is called once the connection has been negotiated. It is used * for rsyncd, remote-shell, and local connections. */
| 1283 | /* This is called once the connection has been negotiated. It is used |
| 1284 | * for rsyncd, remote-shell, and local connections. */ |
| 1285 | int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]) |
| 1286 | { |
| 1287 | struct file_list *flist = NULL; |
| 1288 | int exit_code = 0, exit_code2 = 0; |
| 1289 | char *local_name = NULL; |
| 1290 | |
| 1291 | cleanup_child_pid = pid; |
| 1292 | if (!read_batch) { |
| 1293 | set_nonblocking(f_in); |
| 1294 | set_nonblocking(f_out); |
| 1295 | } |
| 1296 | |
| 1297 | io_set_sock_fds(f_in, f_out); |
| 1298 | setup_protocol(f_out,f_in); |
| 1299 | |
| 1300 | /* We set our stderr file handle to blocking because ssh might have |
| 1301 | * set it to non-blocking. This can be particularly troublesome if |
| 1302 | * stderr is a clone of stdout, because ssh would have set our stdout |
| 1303 | * to non-blocking at the same time (which can easily cause us to lose |
| 1304 | * output from our print statements). This kluge shouldn't cause ssh |
| 1305 | * any problems for how we use it. Note also that we delayed setting |
| 1306 | * this until after the above protocol setup so that we know for sure |
| 1307 | * that ssh is done twiddling its file descriptors. */ |
| 1308 | set_blocking(STDERR_FILENO); |
| 1309 | |
| 1310 | if (am_sender) { |
| 1311 | keep_dirlinks = 0; /* Must be disabled on the sender. */ |
| 1312 | |
| 1313 | if (always_checksum |
| 1314 | && (log_format_has(stdout_format, 'C') |
| 1315 | || log_format_has(logfile_format, 'C'))) |
| 1316 | sender_keeps_checksum = 1; |
| 1317 | |
| 1318 | if (protocol_version >= 30) |
| 1319 | io_start_multiplex_out(f_out); |
| 1320 | else |
| 1321 | io_start_buffering_out(f_out); |
| 1322 | if (protocol_version >= 31 || (!filesfrom_host && protocol_version >= 23)) |
| 1323 | io_start_multiplex_in(f_in); |
| 1324 | else |
| 1325 | io_start_buffering_in(f_in); |
| 1326 | send_filter_list(f_out); |
| 1327 | if (filesfrom_host) |
| 1328 | filesfrom_fd = f_in; |
| 1329 | |
| 1330 | if (write_batch && !am_server) |
| 1331 | start_write_batch(f_out); |
| 1332 | |
| 1333 | become_copy_as_user(); |
| 1334 | |
| 1335 | flist = send_file_list(f_out, argc, argv); |
| 1336 | if (DEBUG_GTE(FLIST, 3)) |
| 1337 | rprintf(FINFO,"file list sent\n"); |
| 1338 | |
| 1339 | if (protocol_version < 31 && filesfrom_host && protocol_version >= 23) |
| 1340 | io_start_multiplex_in(f_in); |
| 1341 | |
| 1342 | io_flush(NORMAL_FLUSH); |
no test coverage detected