| 843 | } |
| 844 | |
| 845 | void log_delete(const char *fname, int mode) |
| 846 | { |
| 847 | static struct file_struct *file = NULL; |
| 848 | int len = strlen(fname); |
| 849 | const char *fmt; |
| 850 | |
| 851 | if (!file) { |
| 852 | int extra_len = (file_extra_cnt + 2) * EXTRA_LEN; |
| 853 | char *bp; |
| 854 | #if EXTRA_ROUNDING > 0 |
| 855 | if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN)) |
| 856 | extra_len = (extra_len | (EXTRA_ROUNDING * EXTRA_LEN)) + EXTRA_LEN; |
| 857 | #endif |
| 858 | |
| 859 | bp = new_array0(char, FILE_STRUCT_LEN + extra_len + 1); |
| 860 | bp += extra_len; |
| 861 | file = (struct file_struct *)bp; |
| 862 | } |
| 863 | |
| 864 | file->mode = mode; |
| 865 | |
| 866 | if (am_server && protocol_version >= 29 && len < MAXPATHLEN) { |
| 867 | if (S_ISDIR(mode)) |
| 868 | len++; /* directories include trailing null */ |
| 869 | send_msg(MSG_DELETED, fname, len, am_generator); |
| 870 | } else if (!INFO_GTE(DEL, 1) && !stdout_format) |
| 871 | ; |
| 872 | else { |
| 873 | fmt = stdout_format_has_o_or_i ? stdout_format : "deleting %n"; |
| 874 | log_formatted(FCLIENT, fmt, "del.", file, fname, ITEM_DELETED, NULL); |
| 875 | } |
| 876 | |
| 877 | if (!logfile_name || dry_run || !logfile_format) |
| 878 | return; |
| 879 | |
| 880 | fmt = logfile_format_has_o_or_i ? logfile_format : "deleting %n"; |
| 881 | log_formatted(FLOG, fmt, "del.", file, fname, ITEM_DELETED, NULL); |
| 882 | } |
| 883 | |
| 884 | /* |
| 885 | * Called when the transfer is interrupted for some reason. |
no test coverage detected