diff options
author | Wayne Davison <wayned@samba.org> | 2005-02-19 22:16:41 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2005-02-19 22:16:41 +0000 |
commit | 1eec003a80ac4eb9f20408966910825ec6c8ed60 (patch) | |
tree | 8f58c446151e17bcdaea20a34bfcb5745366c8b9 /log.c | |
parent | 684d7582b6a58e30b2fddf45989d1d27cbdcd10d (diff) | |
download | rsync-1eec003a80ac4eb9f20408966910825ec6c8ed60.tar.gz rsync-1eec003a80ac4eb9f20408966910825ec6c8ed60.tar.bz2 rsync-1eec003a80ac4eb9f20408966910825ec6c8ed60.zip |
The FCLIENT log code aviods putting the message into the daemon's
log file and instead sends a FINFO message to the client. This is
used when the daemon wants to log a better message locally than it
is sending to the client. Improved log_delete() to make use of this
idiom if it needs to log a separate delete message for the daemon
and the client.
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -37,6 +37,7 @@ extern int msg_fd_out; extern int protocol_version; extern int preserve_times; extern int log_format_has_o_or_i; +extern int daemon_log_format_has_o_or_i; extern char *auth_user; extern char *log_format; @@ -186,7 +187,9 @@ void rwrite(enum logcode code, char *buf, int len) return; } - if (am_daemon) { + if (code == FCLIENT) + code = FINFO; + else if (am_daemon) { static int in_block; char msg[2048]; int priority = code == FERROR ? LOG_WARNING : LOG_INFO; @@ -525,7 +528,6 @@ void log_delete(char *fname, int mode) { static struct file_struct file; int len = strlen(fname); - enum logcode code; char *fmt; file.mode = mode; @@ -535,16 +537,16 @@ void log_delete(char *fname, int mode) if (S_ISDIR(mode)) len++; /* directories include trailing null */ send_msg(MSG_DELETED, fname, len); - if (!am_daemon || dry_run) - return; - fmt = lp_log_format(module_id); - code = FLOG; } else { fmt = log_format_has_o_or_i ? log_format : "%i %n"; - code = FINFO; + log_formatted(FCLIENT, fmt, "del.", &file, &stats, ITEM_DELETED); } - log_formatted(code, fmt, "del.", &file, &stats, ITEM_DELETED); + if (!am_daemon || dry_run) + return; + + fmt = daemon_log_format_has_o_or_i ? lp_log_format(module_id) : "%i %n"; + log_formatted(FLOG, fmt, "del.", &file, &stats, ITEM_DELETED); } |