version 1.1.1.2, 2013/10/14 07:51:14
|
version 1.1.1.3, 2016/11/01 09:54:32
|
Line 4
|
Line 4
|
* Copyright (C) 1996-2001 Andrew Tridgell <tridge@samba.org> |
* Copyright (C) 1996-2001 Andrew Tridgell <tridge@samba.org> |
* Copyright (C) 1996 Paul Mackerras |
* Copyright (C) 1996 Paul Mackerras |
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org> |
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org> |
* Copyright (C) 2003-2013 Wayne Davison | * Copyright (C) 2003-2015 Wayne Davison |
* |
* |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
Line 77 extern size_t bwlimit_writemax;
|
Line 77 extern size_t bwlimit_writemax;
|
extern unsigned int module_dirlen; |
extern unsigned int module_dirlen; |
extern BOOL flist_receiving_enabled; |
extern BOOL flist_receiving_enabled; |
extern BOOL shutting_down; |
extern BOOL shutting_down; |
|
extern BOOL want_progress_now; |
|
extern int backup_dir_len; |
extern int basis_dir_cnt; |
extern int basis_dir_cnt; |
extern struct stats stats; |
extern struct stats stats; |
extern char *stdout_format; |
extern char *stdout_format; |
Line 851 static int do_recv(int f_in, int f_out, char *local_na
|
Line 853 static int do_recv(int f_in, int f_out, char *local_na
|
} |
} |
|
|
if (backup_dir) { |
if (backup_dir) { |
int ret = make_path(backup_dir_buf, MKP_DROP_NAME); /* drops trailing slash */ | STRUCT_STAT st; |
if (ret < 0) | int ret; |
exit_cleanup(RERR_SYNTAX); | if (backup_dir_len > 1) |
if (ret) | backup_dir_buf[backup_dir_len-1] = '\0'; |
rprintf(FINFO, "Created backup_dir %s\n", backup_dir_buf); | ret = do_stat(backup_dir_buf, &st); |
else if (INFO_GTE(BACKUP, 1)) | if (ret != 0 || !S_ISDIR(st.st_mode)) { |
| if (ret == 0) { |
| rprintf(FERROR, "The backup-dir is not a directory: %s\n", backup_dir_buf); |
| exit_cleanup(RERR_SYNTAX); |
| } |
| if (errno != ENOENT) { |
| rprintf(FERROR, "Failed to stat %s: %s\n", backup_dir_buf, strerror(errno)); |
| exit_cleanup(RERR_FILEIO); |
| } |
| rprintf(FINFO, "(new) backup_dir is %s\n", backup_dir_buf); |
| } else if (INFO_GTE(BACKUP, 1)) |
rprintf(FINFO, "backup_dir is %s\n", backup_dir_buf); |
rprintf(FINFO, "backup_dir is %s\n", backup_dir_buf); |
|
if (backup_dir_len > 1) |
|
backup_dir_buf[backup_dir_len-1] = '/'; |
} |
} |
|
|
io_flush(FULL_FLUSH); |
io_flush(FULL_FLUSH); |
Line 1010 static void do_server_recv(int f_in, int f_out, int ar
|
Line 1024 static void do_server_recv(int f_in, int f_out, int ar
|
filesfrom_fd = -1; |
filesfrom_fd = -1; |
} |
} |
|
|
flist = recv_file_list(f_in); | flist = recv_file_list(f_in, -1); |
if (!flist) { |
if (!flist) { |
rprintf(FERROR,"server_recv: recv_file_list error\n"); |
rprintf(FERROR,"server_recv: recv_file_list error\n"); |
exit_cleanup(RERR_FILESELECT); |
exit_cleanup(RERR_FILESELECT); |
} |
} |
|
|
if (inc_recurse && file_total == 1) |
if (inc_recurse && file_total == 1) |
recv_additional_file_list(f_in); |
recv_additional_file_list(f_in); |
|
|
Line 1184 int client_run(int f_in, int f_out, pid_t pid, int arg
|
Line 1199 int client_run(int f_in, int f_out, pid_t pid, int arg
|
|
|
if (write_batch && !am_server) |
if (write_batch && !am_server) |
start_write_batch(f_in); |
start_write_batch(f_in); |
flist = recv_file_list(f_in); | flist = recv_file_list(f_in, -1); |
if (inc_recurse && file_total == 1) |
if (inc_recurse && file_total == 1) |
recv_additional_file_list(f_in); |
recv_additional_file_list(f_in); |
|
|
Line 1412 static int start_client(int argc, char *argv[])
|
Line 1427 static int start_client(int argc, char *argv[])
|
} |
} |
|
|
|
|
static RETSIGTYPE sigusr1_handler(UNUSED(int val)) | static void sigusr1_handler(UNUSED(int val)) |
{ |
{ |
exit_cleanup(RERR_SIGNAL1); |
exit_cleanup(RERR_SIGNAL1); |
} |
} |
|
|
static RETSIGTYPE sigusr2_handler(UNUSED(int val)) | static void sigusr2_handler(UNUSED(int val)) |
{ |
{ |
if (!am_server) |
if (!am_server) |
output_summary(); |
output_summary(); |
Line 1427 static RETSIGTYPE sigusr2_handler(UNUSED(int val))
|
Line 1442 static RETSIGTYPE sigusr2_handler(UNUSED(int val))
|
_exit(0); |
_exit(0); |
} |
} |
|
|
RETSIGTYPE remember_children(UNUSED(int val)) | #ifdef SIGINFO |
| static void siginfo_handler(UNUSED(int val)) |
{ |
{ |
|
|
|
if (!am_server) |
|
want_progress_now = True; |
|
} |
|
#endif |
|
|
|
void remember_children(UNUSED(int val)) |
|
{ |
#ifdef WNOHANG |
#ifdef WNOHANG |
int cnt, status; |
int cnt, status; |
pid_t pid; |
pid_t pid; |
Line 1488 const char *get_panic_action(void)
|
Line 1512 const char *get_panic_action(void)
|
* should just look at the environment variable, but I'm a bit leery |
* should just look at the environment variable, but I'm a bit leery |
* of a signal sending us into a busy loop. |
* of a signal sending us into a busy loop. |
**/ |
**/ |
static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig)) | static void rsync_panic_handler(UNUSED(int whatsig)) |
{ |
{ |
char cmd_buf[300]; |
char cmd_buf[300]; |
int ret, pid_int = getpid(); |
int ret, pid_int = getpid(); |
Line 1525 int main(int argc,char *argv[])
|
Line 1549 int main(int argc,char *argv[])
|
SIGACTMASK(SIGFPE, rsync_panic_handler); |
SIGACTMASK(SIGFPE, rsync_panic_handler); |
SIGACTMASK(SIGABRT, rsync_panic_handler); |
SIGACTMASK(SIGABRT, rsync_panic_handler); |
SIGACTMASK(SIGBUS, rsync_panic_handler); |
SIGACTMASK(SIGBUS, rsync_panic_handler); |
|
#endif |
|
#ifdef SIGINFO |
|
SIGACTMASK(SIGINFO, siginfo_handler); |
#endif |
#endif |
|
|
starttime = time(NULL); |
starttime = time(NULL); |