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

Function send_protected_args

rsync.c:283–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281#endif
282
283void send_protected_args(int fd, char *args[])
284{
285 int i;
286#ifdef ICONV_OPTION
287 int convert = ic_send != (iconv_t)-1;
288 xbuf outbuf, inbuf;
289
290 if (convert)
291 alloc_xbuf(&outbuf, 1024);
292#endif
293
294 for (i = 0; args[i]; i++) {} /* find first NULL */
295 args[i] = "rsync"; /* set a new arg0 */
296 if (DEBUG_GTE(CMD, 1))
297 print_child_argv("protected args:", args + i + 1);
298 do {
299 if (!args[i][0])
300 write_buf(fd, ".", 2);
301#ifdef ICONV_OPTION
302 else if (convert) {
303 INIT_XBUF_STRLEN(inbuf, args[i]);
304 iconvbufs(ic_send, &inbuf, &outbuf,
305 ICB_EXPAND_OUT | ICB_INCLUDE_BAD | ICB_INCLUDE_INCOMPLETE | ICB_INIT);
306 outbuf.buf[outbuf.len] = '\0';
307 write_buf(fd, outbuf.buf, outbuf.len + 1);
308 outbuf.len = 0;
309 }
310#endif
311 else
312 write_buf(fd, args[i], strlen(args[i]) + 1);
313 } while (args[++i]);
314 write_byte(fd, 0);
315
316#ifdef ICONV_OPTION
317 if (convert)
318 free(outbuf.buf);
319#endif
320}
321
322int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr, char *buf, int *len_ptr)
323{

Callers 2

do_cmdFunction · 0.85
start_inband_exchangeFunction · 0.85

Calls 4

alloc_xbufFunction · 0.85
print_child_argvFunction · 0.85
write_bufFunction · 0.85
write_byteFunction · 0.85

Tested by

no test coverage detected