From b2cd652db2e79417a6b176bc065bc91550ecb089 Mon Sep 17 00:00:00 2001 From: martin-s Date: Thu, 5 Jan 2006 16:40:39 +0000 Subject: [PATCH] Bugfix for street popup, unmap map files before core dump git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@62 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/debug.c | 2 +- navit/src/file.c | 23 ++++++++++++++++++++++- navit/src/file.h | 2 ++ navit/src/street.c | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/navit/src/debug.c b/navit/src/debug.c index 68edf71..3c19218 100644 --- a/navit/src/debug.c +++ b/navit/src/debug.c @@ -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(); diff --git a/navit/src/file.c b/navit/src/file.c index cdff873..b097261 100644 --- a/navit/src/file.c +++ b/navit/src/file.c @@ -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) { diff --git a/navit/src/file.h b/navit/src/file.h index e8e00cc..f020ee4 100644 --- a/navit/src/file.h +++ b/navit/src/file.h @@ -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); diff --git a/navit/src/street.c b/navit/src/street.c index 0560135..3fb5e23 100644 --- a/navit/src/street.c +++ b/navit/src/street.c @@ -466,7 +466,7 @@ street_get_param(struct segment *seg, struct param_list *param, int count, int v param_add_hex("Unknown3", str->unknown3, ¶m, &count); param_add_hex("Type", str->type, ¶m, &count); param_add_hex("Name-Id", str->nameid, ¶m, &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, ¶m, &count); -- 2.7.4