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

Function open_batch_files

batch.c:225–248  ·  view source on GitHub ↗

This sets batch_fd and (for --write-batch) batch_sh_fd. */

Source from the content-addressed store, hash-verified

223
224/* This sets batch_fd and (for --write-batch) batch_sh_fd. */
225void 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

Callers 1

mainFunction · 0.85

Calls 4

stringjoinFunction · 0.85
do_openFunction · 0.85
full_fnameFunction · 0.85
rsyserrFunction · 0.70

Tested by

no test coverage detected