From 7a4bd30dba8e36a2e050450d50bafe231ddca8e8 Mon Sep 17 00:00:00 2001 From: Tim Pepper Date: Tue, 11 Sep 2012 12:38:44 -0700 Subject: [PATCH] Remove unlink option This will be handled for us by tmpwatch Signed-off-by: Tim Pepper --- corewatcher.conf | 5 ----- src/configfile.c | 21 ++++++++------------- src/corewatcher.h | 1 - src/submit.c | 16 ++++++---------- 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/corewatcher.conf b/corewatcher.conf index 115eb43..8f0c40a 100644 --- a/corewatcher.conf +++ b/corewatcher.conf @@ -31,11 +31,6 @@ allow-submit=yes allow-pass-on=yes # -# Delete the coredumps after processing -# -unlink=no - -# # URL for submitting the backtraces # Up to 10 additional URLs can be added in the same format # ie: diff --git a/src/configfile.c b/src/configfile.c index 2372d23..ab3b503 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -36,13 +36,12 @@ char *submit_url[MAX_URLS]; char *build_release = NULL; char *core_folder = NULL; int url_count = 0; -int do_unlink = 0; void read_config_file(char *filename) { FILE *file = NULL; - char *line = NULL, *line_len = NULL; - size_t dummy = 0; + char *line = NULL, *line_end = NULL; + size_t line_len = 0; file = fopen(filename, "r"); if (!file) @@ -51,30 +50,26 @@ void read_config_file(char *filename) char *c = NULL; char *n = NULL; - if (getline(&line, &dummy, file) == -1) + if (getline(&line, &line_len, file) == -1) break; if (line[0] == '#') continue; /* we don't care about any lines that are too short to have config options */ - if (dummy < 5) + if (line_len < 5) continue; /* remove trailing\n */ n = strchr(line, '\n'); if (n) *n = 0; - line_len = line + dummy; - c = strstr(line, "unlink"); - if (c) - if (strstr(c, "yes")) - do_unlink = 1; + line_end = line + line_len; c = strstr(line, "submit-url"); if (c && url_count <= MAX_URLS) { c += 11; - if (c < line_len) { + if (c < line_end) { c = strstr(c, "http:"); if (c) { submit_url[url_count] = strdup(c); @@ -88,7 +83,7 @@ void read_config_file(char *filename) c = strstr(line, "release-info"); if (c) { c += 11; - if (c < line_len) { + if (c < line_end) { c = strstr(c, "/"); if (c) build_release = strdup(c); @@ -97,7 +92,7 @@ void read_config_file(char *filename) c = strstr(line, "core-folder"); if (c) { c += 11; - if (c < line_len) { + if (c < line_end) { c = strstr(c, "/"); if (c) core_folder = strdup(c); diff --git a/src/corewatcher.h b/src/corewatcher.h index 88295b3..7a94baa 100644 --- a/src/corewatcher.h +++ b/src/corewatcher.h @@ -89,7 +89,6 @@ extern char *submit_url[MAX_URLS]; extern char *build_release; extern char *core_folder; extern int url_count; -extern int do_unlink; /* corewatcher.c */ extern int testmode; diff --git a/src/submit.c b/src/submit.c index 2e9da65..62622d1 100644 --- a/src/submit.c +++ b/src/submit.c @@ -227,16 +227,12 @@ static void submit_queue_with_url(struct oops *queue, char *wsubmit_url, char *p if (!result) { char *nf = NULL; - if (do_unlink || (!(nf = replace_name(oops->filename, ".processed", ".submitted")))) { - unlink(oops->detail_filename); - unlink(oops->filename); - } else { - rename(oops->filename, nf); - pthread_mutex_lock(&core_status.processing_mtx); - remove_pid_from_hash(oops->filename, core_status.processing_oops); - pthread_mutex_unlock(&core_status.processing_mtx); - free(nf); - } + nf = replace_name(oops->filename, ".processed", ".submitted"); + rename(oops->filename, nf); + pthread_mutex_lock(&core_status.processing_mtx); + remove_pid_from_hash(oops->filename, core_status.processing_oops); + pthread_mutex_unlock(&core_status.processing_mtx); + free(nf); g_hash_table_remove(core_status.queued_oops, oops->filename); count++; -- 2.7.4