X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/4e815e909d12b32459bc521c36b991194df24865..c2cf03332f51a9fa992220124635f737399fba91:/src/download.c diff --git a/src/download.c b/src/download.c index d640d222..ef75b02f 100644 --- a/src/download.c +++ b/src/download.c @@ -50,6 +50,7 @@ #include "curl_download.h" #include "preferences.h" #include "globals.h" +#include "vik_compat.h" static gboolean check_file_first_line(FILE* f, gchar *patterns[]) { @@ -135,8 +136,12 @@ void a_download_init (void) VikLayerParamData tmp; tmp.u = VIK_CONFIG_DEFAULT_TILE_AGE / 86400; // Now in days a_preferences_register(prefs, tmp, VIKING_PREFERENCES_GROUP_KEY); + file_list_mutex = vik_mutex_new(); +} - file_list_mutex = g_mutex_new(); +void a_download_uninit (void) +{ + vik_mutex_free(file_list_mutex); } static gboolean lock_file(const char *fn) @@ -361,7 +366,9 @@ static DownloadResult_t download( const char *hostname, const char *uri, const c utimes ( fn, NULL ); /* update mtime of local copy */ #endif } else { - g_rename ( tmpfilename, fn ); /* move completely-downloaded file to permanent location */ + /* move completely-downloaded file to permanent location */ + if ( g_rename ( tmpfilename, fn ) ) + g_warning ("%s: file rename failed [%s] to [%s]", __FUNCTION__, tmpfilename, fn ); } unlock_file ( tmpfilename ); g_free ( tmpfilename );