diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-08 23:22:16 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-08 23:22:16 +0100 |
commit | d50e22f72987597152198811a22e50a97a902bcc (patch) | |
tree | e6bca75114214dd7669bd91c9d977f50e8c09390 /storage_xml.c | |
parent | f1cea66ac5fcd860b2702e6b8ab01fcb79179bd4 (diff) | |
parent | 04a927cb733e2c47424569550a2faeb108094636 (diff) |
Merging memory leak fixes from devel, time to find the ui-fix-specific
leaks.
Diffstat (limited to 'storage_xml.c')
-rw-r--r-- | storage_xml.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/storage_xml.c b/storage_xml.c index a0e2fd25..3ce85713 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -403,8 +403,8 @@ static storage_status_t xml_save( irc_t *irc, int overwrite ) if( !overwrite && g_access( path, F_OK ) == 0 ) return STORAGE_ALREADY_EXISTS; - strcat( path, "~" ); - if( ( fd = open( path, O_WRONLY | O_CREAT | O_TRUNC, 0600 ) ) < 0 ) + strcat( path, ".XXXXXX" ); + if( ( fd = mkstemp( path ) ) < 0 ) { irc_usermsg( irc, "Error while opening configuration file." ); return STORAGE_OTHER_ERROR; @@ -500,7 +500,7 @@ static storage_status_t xml_save( irc_t *irc, int overwrite ) fsync( fd ); close( fd ); - path2 = g_strndup( path, strlen( path ) - 1 ); + path2 = g_strndup( path, strlen( path ) - 7 ); if( rename( path, path2 ) != 0 ) { irc_usermsg( irc, "Error while renaming temporary configuration file." ); |