summaryrefslogtreecommitdiffstats
path: root/linux.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-15 20:51:06 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-17 21:03:30 -0400
commit7148dea82795b81311c46dfb11d09c8fa2b13452 (patch)
tree5635ac7d83b99b8c774af655c5fdfa2a443ef900 /linux.c
parentfa2f1b6eb06e65e6426cc3a488c6cb5c960e7d49 (diff)
downloadsubsurface-7148dea82795b81311c46dfb11d09c8fa2b13452.tar.gz
Once again improve existing filename handling
Several potential problems. - we could end up dereferencing exiting_filename when it was NULL - we could free the default_filename by mistake - subsurface_default_filename always needs to return a copy of it - closing the existing file before opening a new one repopulated the existing_filename with the default filename - preventing the opened file to become the new existing filename Also, make existing filename a const char * and make file_open have the same sensible default folder behavior as the other file related functions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'linux.c')
-rw-r--r--linux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux.c b/linux.c
index 8d9f6f8ce..47a00a059 100644
--- a/linux.c
+++ b/linux.c
@@ -69,7 +69,7 @@ const char *subsurface_icon_name()
const char *subsurface_default_filename()
{
if (default_filename) {
- return default_filename;
+ return strdup(default_filename);
} else {
const char *home, *user;
char *buffer;