| 281 | #endif |
| 282 | |
| 283 | void 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 | |
| 322 | int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr, char *buf, int *len_ptr) |
| 323 | { |
no test coverage detected