Bugfix for street popup, unmap map files before core dump
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 5 Jan 2006 16:40:39 +0000 (16:40 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 5 Jan 2006 16:40:39 +0000 (16:40 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@62 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/src/debug.c
navit/src/file.c
navit/src/file.h
navit/src/street.c

index 68edf71..3c19218 100644 (file)
@@ -17,7 +17,7 @@ static int sigsegv(void)
        fprintf(f,"segmentation fault received\n");
        t=time(NULL);
        fprintf(f,"Time: %s", ctime(&t));
-       file_remap_readonly_all();
+       file_unmap_all();
        fprintf(f,"dumping core\n");
        fclose(f);      
        abort();
index cdff873..b097261 100644 (file)
@@ -55,13 +55,34 @@ void
 file_remap_readonly_all(void)
 {
        struct file *f=file_list;
+       int limit=1000;
 
-       while (f) {
+       while (f && limit-- > 0) {
                file_remap_readonly(f);
                f=f->next;
        }
 }
 
+void
+file_unmap(struct file *f)
+{
+       munmap(f->begin, f->size);
+}
+
+void
+file_unmap_all(void)
+{
+       struct file *f=file_list;
+       int limit=1000;
+
+       while (f && limit-- > 0) {
+               file_unmap(f);
+               f=f->next;
+       }
+}
+
+
+
 void *
 file_opendir(char *dir)
 {
index e8e00cc..f020ee4 100644 (file)
@@ -13,6 +13,8 @@ struct file {
 struct file *file_create(char *name);
 void file_remap_readonly(struct file *file);
 void file_remap_readonly_all(void);
+void file_unmap(struct file *file);
+void file_unmap_all(void);
 struct file *file_create_caseinsensitive(char *name);
 int file_get_param(struct file *file, struct param_list *param, int count);
 void file_destroy(struct file *f);
index 0560135..3fb5e23 100644 (file)
@@ -466,7 +466,7 @@ street_get_param(struct segment *seg, struct param_list *param, int count, int v
        param_add_hex("Unknown3", str->unknown3, &param, &count);
        param_add_hex("Type", str->type, &param, &count);
        param_add_hex("Name-Id", str->nameid, &param, &count);
-       if (str->segid) {
+       if (str->segid && str->nameid) {
                street_name_get_by_id(&name, seg->blk_inf.mdata, str->nameid);
 
                param_add_hex("Len", name.len, &param, &count);