From a9766ef1472d04df22178f69ea7bfde36f2b7242 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 15 Nov 1998 01:21:42 +0000 Subject: [PATCH] log filename(line) in exit_cleanup() to make tracking down problems easier in rsync daemons. --- cleanup.c | 4 ++-- log.c | 7 ++++--- main.c | 2 +- rsync.h | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cleanup.c b/cleanup.c index ee2fa4d5..be795034 100644 --- a/cleanup.c +++ b/cleanup.c @@ -31,7 +31,7 @@ static int cleanup_fd1, cleanup_fd2; static struct map_struct *cleanup_buf; static int cleanup_pid = 0; -void exit_cleanup(int code) +void _exit_cleanup(int code, const char *file, int line) { extern int keep_partial; @@ -58,7 +58,7 @@ void exit_cleanup(int code) } } - if (code) log_exit(code); + if (code) log_exit(code, file, line); exit(code); } diff --git a/log.c b/log.c index 6594d454..82a88cd5 100644 --- a/log.c +++ b/log.c @@ -295,7 +295,7 @@ void log_recv(struct file_struct *file, struct stats *initial_stats) } /* called when the transfer is interrupted for some reason */ -void log_exit(int code) +void log_exit(int code, const char *file, int line) { if (code == 0) { extern struct stats stats; @@ -304,7 +304,8 @@ void log_exit(int code) (double)stats.total_read, (double)stats.total_size); } else { - rprintf(FLOG,"transfer interrupted (code %d)\n", code); + rprintf(FLOG,"transfer interrupted (code %d) at %s(%d)\n", + code, file, line); } } @@ -313,7 +314,7 @@ void log_exit(int code) it i called when a file starts to be transferred */ -void log_transfer(struct file_struct *file, char *fname) +void log_transfer(struct file_struct *file, const char *fname) { extern int verbose; diff --git a/main.c b/main.c index 9b377386..737a78af 100644 --- a/main.c +++ b/main.c @@ -36,7 +36,7 @@ static void report(int f) extern int do_stats; if (am_daemon) { - log_exit(0); + log_exit(0, __FILE__, __LINE__); if (f == -1 || !am_sender) return; } diff --git a/rsync.h b/rsync.h index 53b1c318..5ea5301d 100644 --- a/rsync.h +++ b/rsync.h @@ -484,3 +484,4 @@ size_t strlcpy(char *d, const char *s, size_t bufsize); size_t strlcat(char *d, const char *s, size_t bufsize); #endif +#define exit_cleanup(code) _exit_cleanup(code, __FILE__, __LINE__) -- 2.34.1