This sets batch_fd and (for --write-batch) batch_sh_fd. */
| 223 | |
| 224 | /* This sets batch_fd and (for --write-batch) batch_sh_fd. */ |
| 225 | void open_batch_files(void) |
| 226 | { |
| 227 | if (write_batch) { |
| 228 | char filename[MAXPATHLEN]; |
| 229 | |
| 230 | stringjoin(filename, sizeof filename, batch_name, ".sh", NULL); |
| 231 | |
| 232 | batch_sh_fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IXUSR); |
| 233 | if (batch_sh_fd < 0) { |
| 234 | rsyserr(FERROR, errno, "Batch file %s open error", full_fname(filename)); |
| 235 | exit_cleanup(RERR_FILESELECT); |
| 236 | } |
| 237 | |
| 238 | batch_fd = do_open(batch_name, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); |
| 239 | } else if (strcmp(batch_name, "-") == 0) |
| 240 | batch_fd = STDIN_FILENO; |
| 241 | else |
| 242 | batch_fd = do_open(batch_name, O_RDONLY, S_IRUSR | S_IWUSR); |
| 243 | |
| 244 | if (batch_fd < 0) { |
| 245 | rsyserr(FERROR, errno, "Batch file %s open error", full_fname(batch_name)); |
| 246 | exit_cleanup(RERR_FILEIO); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | /* This routine tries to write out an equivalent --read-batch command |
| 251 | * given the user's --write-batch args. However, it doesn't really |
no test coverage detected