#959 closed defect/bug (fixed)
Navit crashes if destination.txt cannot be written
Reported by: | sleske | Owned by: | KaZeR |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | core | Version: | git master |
Severity: | Keywords: | ||
Cc: | nick@… |
Description
If destination.txt cannot be written to (for example because of filesystem permissions), Navit will segfault as soon as it tries to write to it.
To reproduce (on Linux):
- set destination.txt read-only: chmod a-w path/to/destination.txt
- start Navit
- set a destination (by choosing a bookmark, or entering it directly)
Navit will segfault. Backtrace (shortened):
[...] #4 0x08062ecf in sigsegv (sig=11) at debug.c:80 #5 <signal handler called> #6 0xb7463e47 in fclose () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 #7 0x08093074 in bookmarks_append_coord at bookmarks.c:704 #8 0x080731ff in navit_set_destination at navit.c:1483 [...]
Attachments (2)
Change History (6)
Changed 11 years ago by sleske
comment:1 Changed 11 years ago by sleske
The cause of this crash is that Navit tries to close the file handle for destination.txt, even if the fopen() call failed (in bookmarks.c, function bookmarks_append_coord).
I attached a patch to fix this.
Changed 11 years ago by number6
This patch uses dbg to notify the user, and stops the program from crashing
comment:2 Changed 11 years ago by number6
- Cc nick@… added
comment:3 Changed 11 years ago by number6
- Resolution set to fixed
- Status changed from new to closed
Added my own patch in Revision 4845!
comment:4 Changed 11 years ago by sleske
Hm, to be honest, I believe my patch is a bit better (because it prints the cause of the error). Anyway, the main thing is that it's fixed.
Fix for issue #959: Do not call fclose() if fopen() failed