X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/2936913db44777623e5c5de18758f3833554fb3e..4e53f3dcd47d9208cff59bdacefdacf554b37962:/src/curl_download.c diff --git a/src/curl_download.c b/src/curl_download.c index 6111bfe7..302f4b94 100644 --- a/src/curl_download.c +++ b/src/curl_download.c @@ -65,7 +65,13 @@ static gchar *get_cookie_file(gboolean init) g_mutex_lock(mutex); if (g_file_test(cookie_file, G_FILE_TEST_EXISTS) == FALSE) { /* file not there */ - FILE * out_file = g_fopen("/dev/null", "w"); + gchar * name_tmp = NULL; + FILE * out_file = tmpfile(); + if (out_file == NULL) { + // Something wrong with previous call (unsuported?) + name_tmp = g_strdup_printf("%s.tmp", cookie_file); + out_file = g_fopen(name_tmp, "w+b"); + } CURLcode res; CURL *curl = curl_easy_init(); if (vik_verbose) @@ -83,6 +89,11 @@ static gchar *get_cookie_file(gboolean init) curl_easy_cleanup(curl); fclose(out_file); out_file = NULL; + if (name_tmp != NULL) { + g_remove(name_tmp); + g_free(name_tmp); + name_tmp = NULL; + } } g_mutex_unlock(mutex);