* Called when the transfer is interrupted for some reason. * * Code is one of the RERR_* codes from errcode.h, or terminating * successfully. */
| 888 | * successfully. |
| 889 | */ |
| 890 | void log_exit(int code, const char *file, int line) |
| 891 | { |
| 892 | /* The receiving side's stats are split between 2 procs until the |
| 893 | * end of the run, so only the sender can output non-final info. */ |
| 894 | if (code == 0 || am_sender) { |
| 895 | rprintf(FLOG,"sent %s bytes received %s bytes total size %s\n", |
| 896 | big_num(stats.total_written), |
| 897 | big_num(stats.total_read), |
| 898 | big_num(stats.total_size)); |
| 899 | } |
| 900 | if (code != 0 && am_server != 2) { |
| 901 | const char *name; |
| 902 | |
| 903 | name = rerr_name(code); |
| 904 | if (!name) |
| 905 | name = "unexplained error"; |
| 906 | |
| 907 | /* VANISHED is not an error, only a warning */ |
| 908 | if (code == RERR_VANISHED) { |
| 909 | rprintf(FWARNING, "rsync warning: %s (code %d) at %s(%d) [%s=%s]\n", |
| 910 | name, code, src_file(file), line, who_am_i(), rsync_version()); |
| 911 | } else { |
| 912 | rprintf(FERROR, "rsync error: %s (code %d) at %s(%d) [%s=%s]\n", |
| 913 | name, code, src_file(file), line, who_am_i(), rsync_version()); |
| 914 | } |
| 915 | } |
| 916 | } |
no test coverage detected