Remove unlink option
authorTim Pepper <timothy.c.pepper@linux.intel.com>
Tue, 11 Sep 2012 19:38:44 +0000 (12:38 -0700)
committerTim Pepper <timothy.c.pepper@linux.intel.com>
Tue, 11 Sep 2012 19:38:44 +0000 (12:38 -0700)
This will be handled for us by tmpwatch

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
corewatcher.conf
src/configfile.c
src/corewatcher.h
src/submit.c

index 115eb43..8f0c40a 100644 (file)
@@ -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:
index 2372d23..ab3b503 100644 (file)
@@ -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);
index 88295b3..7a94baa 100644 (file)
@@ -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;
index 2e9da65..62622d1 100644 (file)
@@ -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++;