mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-03-28 19:23:36 -04:00
Complain about a missing/non-dir --temp-dir.
This commit is contained in:
3
NEWS.md
3
NEWS.md
@@ -23,6 +23,9 @@
|
||||
get out of sync between the sender and the receiver, which could cause a
|
||||
device to get created with the wrong major value in its major,minor pair.
|
||||
|
||||
- Rsync now complains about a missing `--temp-dir` before starting any file
|
||||
transfers.
|
||||
|
||||
### ENHANCEMENTS:
|
||||
|
||||
- Allow `--max-alloc=0` to specify no limit to the alloc sanity check.
|
||||
|
||||
18
main.c
18
main.c
@@ -97,6 +97,7 @@ extern char *shell_cmd;
|
||||
extern char *password_file;
|
||||
extern char *backup_dir;
|
||||
extern char *copy_as;
|
||||
extern char *tmpdir;
|
||||
extern char curr_dir[MAXPATHLEN];
|
||||
extern char backup_dir_buf[MAXPATHLEN];
|
||||
extern char *basis_dir[MAX_BASIS_DIRS+1];
|
||||
@@ -1002,6 +1003,23 @@ static int do_recv(int f_in, int f_out, char *local_name)
|
||||
backup_dir_buf[backup_dir_len-1] = '/';
|
||||
}
|
||||
|
||||
if (tmpdir) {
|
||||
STRUCT_STAT st;
|
||||
int ret = do_stat(tmpdir, &st);
|
||||
if (ret < 0 || !S_ISDIR(st.st_mode)) {
|
||||
if (ret == 0) {
|
||||
rprintf(FERROR, "The temp-dir is not a directory: %s\n", tmpdir);
|
||||
exit_cleanup(RERR_SYNTAX);
|
||||
}
|
||||
if (errno == ENOENT) {
|
||||
rprintf(FERROR, "The temp-dir does not exist: %s\n", tmpdir);
|
||||
exit_cleanup(RERR_SYNTAX);
|
||||
}
|
||||
rprintf(FERROR, "Failed to stat temp-dir %s: %s\n", tmpdir, strerror(errno));
|
||||
exit_cleanup(RERR_FILEIO);
|
||||
}
|
||||
}
|
||||
|
||||
io_flush(FULL_FLUSH);
|
||||
|
||||
if ((pid = do_fork()) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user