Change behavior to avoid rerunning gdb each time we try scan corefiles
authorWilliam Douglas <william.douglas@linux.intel.com>
Fri, 22 Apr 2011 22:15:49 +0000 (15:15 -0700)
committerWilliam Douglas <william.douglas@linux.intel.com>
Fri, 22 Apr 2011 22:15:49 +0000 (15:15 -0700)
Signed-off-by: William Douglas <william.douglas@linux.intel.com>
coredump.c
corewatcher.h
submit.c

index fbafdd1..f9cbe2c 100644 (file)
@@ -526,6 +526,7 @@ int scan_dmesg(void __unused *unused)
        DIR *dir;
        struct dirent *entry;
        char path[PATH_MAX*2];
+       struct oops *oq;
 
        dir = opendir("/tmp/");
        if (!dir)
@@ -554,15 +555,23 @@ int scan_dmesg(void __unused *unused)
 
        fprintf(stderr, "+ scanning %s...\n", core_folder);
        do {
+       skip:
+               memset(path, 0, PATH_MAX*2);
+               oq = get_oops_queue();
                entry = readdir(dir);
                if (!entry)
                        break;
                if (!strstr(entry->d_name, ".processed"))
                        continue;
                sprintf(path, "%s%s", core_folder, entry->d_name);
+               while (oq) {
+                       if (!(strcmp(oq->filename, path)))
+                               goto skip;
+                       oq = oq->next;
+               }
                fprintf(stderr, "+ Looking at %s\n", path);
                process_corefile(path);
-       } while(entry);
+       } while(1);
        closedir(dir);
 
        if (opted_in >= 2)
index b8a634d..3b90fc1 100644 (file)
@@ -57,7 +57,7 @@ extern void clear_queue(void);
 extern int scan_dmesg(void * unused);
 extern void read_config_file(char *filename);
 
-
+extern struct oops *get_oops_queue(void);
 extern void ask_permission(char *detail_folder);
 extern void dbus_ask_permission(char *detail_folder);
 extern void dbus_say_thanks(char *url);
index f2066c1..7c8173b 100644 (file)
--- a/submit.c
+++ b/submit.c
@@ -62,6 +62,11 @@ static struct oops *queued_backtraces;
 static int newoops;
 static int unsubmittedoops;
 
+struct oops *get_oops_queue(void)
+{
+       return queued_backtraces;
+}
+
 static unsigned int checksum(char *ptr)
 {
        unsigned int temp = 0;
@@ -220,7 +225,8 @@ void submit_queue_with_url(struct oops *queue, char *wsubmit_url, char *proxy)
 
                        checksums[submitted++] = oops->checksum;
                        dbus_say_thanks(result_url);
-               }
+               } else
+                       queue_backtrace(oops);
 
                count++;
        dup:
@@ -243,7 +249,7 @@ void submit_queue_with_url(struct oops *queue, char *wsubmit_url, char *proxy)
 
 void submit_queue(void)
 {
-       int i, n;
+       int i, n, submitted = 0;
        struct oops *queue, *oops, *next;
        CURL *handle;
        pxProxyFactory *pf;
@@ -278,6 +284,7 @@ void submit_queue(void)
                }
                if (!curl_easy_perform(handle)) {
                        submit_queue_with_url(queue, submit_url[i], proxy);
+                       submitted = 1;
                        break;
                }
                for (n = 0; proxies[n]; n++)
@@ -287,12 +294,15 @@ void submit_queue(void)
 
        px_proxy_factory_free(pf);
 
-       oops = queue;
-       while (oops) {
-               next = oops->next;
-               FREE_OOPS(oops);
-               oops = next;
-       }
+       if (submitted) {
+               oops = queue;
+               while (oops) {
+                       next = oops->next;
+                       FREE_OOPS(oops);
+                       oops = next;
+               }
+       } else
+               queued_backtraces = queue;
 
        curl_easy_cleanup(handle);
 }