diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-06-15 17:28:19 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-06-15 17:28:19 +0000 |
commit | 2f84b170a6d8a5ce76bf0d8f19848361b319080f (patch) | |
tree | 892695a5e1f50fa15df0c1026d5aa58e9d9ecc4f /src | |
parent | 1f2fe53c4b9bbf3f10bcea81a87327e71ab72908 (diff) | |
download | tinyproxy-2f84b170a6d8a5ce76bf0d8f19848361b319080f.tar.gz tinyproxy-2f84b170a6d8a5ce76bf0d8f19848361b319080f.zip |
Removed the rotate_log_files() function since I'm moving to an Apache style where the _user_ needs to move the log file themselves, and tinyproxy will continue to write to the original name. This allows more flexibility for users to determine their own log rotation scheme.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.c | 70 | ||||
-rw-r--r-- | src/utils.h | 4 |
2 files changed, 2 insertions, 72 deletions
diff --git a/src/utils.c b/src/utils.c index fdc6d4a..4947afb 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,4 @@ -/* $Id: utils.c,v 1.32 2002-05-31 18:26:30 rjkaes Exp $ +/* $Id: utils.c,v 1.33 2002-06-15 17:28:19 rjkaes Exp $ * * Misc. routines which are used by the various functions to handle strings * and memory allocation and pretty much anything else we can think of. Also, @@ -282,71 +282,3 @@ pidfile_create(const char *filename) fprintf(fd, "%ld\n", (long) getpid()); fclose(fd); } - -/* - * Rotate the current log file. This is performed whenever a SIGHUP is - * received. - */ -void -rotate_log_files(void) -{ - char* rename_file; - int log_file_des; - FILE *old_fd; - FILE* new_fd; - - log_message(LOG_NOTICE, "SIGHUP received, cleaning up."); - -#ifdef FILTER_ENABLE - if (config.filter) { - filter_destroy(); - filter_init(); - } - log_message(LOG_NOTICE, "Re-reading filter file."); -#endif /* FILTER_ENABLE */ - - if (config.logf) { - rename_file = safemalloc(strlen(config.logf_name) + 5); - if (!rename_file) { - log_message(LOG_CRIT, - "Could not allocate memory when trying to rotate the log file; therefore, the log has not been rotated."); - return; - } - - strcpy(rename_file, config.logf_name); - strcat(rename_file, ".rot"); - - rename(config.logf_name, rename_file); - - log_file_des = create_file_safely(config.logf_name, TRUE); - if (log_file_des < 0) { - log_message(LOG_CRIT, - "Could not properly create the new log file; therefore the log has not been rotated."); - - /* Switch the file name back */ - rename(rename_file, config.logf_name); - safefree(rename_file); - return; - } - - old_fd = config.logf; - if (!(new_fd = fdopen(log_file_des, "w"))) { - log_message(LOG_CRIT, - "Could not create the new log file; therefore, the log has not been rotated."); - - /* Switch the file name back */ - rename(rename_file, config.logf_name); - safefree(rename_file); - } - - config.logf = new_fd; - fclose(old_fd); - - log_message(LOG_NOTICE, "Log file rotated."); - - safefree(rename_file); - } - - log_message(LOG_NOTICE, - "Finished cleaning memory/connections."); -} diff --git a/src/utils.h b/src/utils.h index 52fdb3c..9213bd0 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,4 +1,4 @@ -/* $Id: utils.h,v 1.19 2002-05-31 18:27:13 rjkaes Exp $ +/* $Id: utils.h,v 1.20 2002-06-15 17:28:19 rjkaes Exp $ * * See 'utils.h' for a detailed description. * @@ -32,6 +32,4 @@ extern int indicate_http_error(struct conn_s* connptr, int number, const char *s extern void pidfile_create(const char *path); extern int create_file_safely(const char *filename, bool_t truncate_file); -extern void rotate_log_files(void); - #endif |