Merge branch 'gnss-upload-failure' into 'master'

gnss: properly clean temporary file before downloading assistance data

Closes #17

See merge request mobian1/devices/eg25-manager!27
This commit is contained in:
Arnaud Ferraris
2021-09-27 17:51:22 +00:00
3 changed files with 10 additions and 7 deletions

View File

@@ -190,7 +190,9 @@ static void fetch_assistance_data(struct EG25Manager *manager)
long int size; long int size;
/* Fetch assistance data with curl */ /* Fetch assistance data with curl */
tmp_file = fdopen(manager->gnss_assistance_fd, "wb"); tmp_file = fdopen(manager->gnss_assistance_fd, "wb+");
lseek(manager->gnss_assistance_fd, 0, SEEK_SET);
ftruncate(manager->gnss_assistance_fd, 0);
url = g_strconcat(manager->gnss_assistance_url, "/", url = g_strconcat(manager->gnss_assistance_url, "/",
manager->gnss_assistance_file, NULL); manager->gnss_assistance_file, NULL);
curl = curl_easy_init(); curl = curl_easy_init();

View File

@@ -7,6 +7,7 @@
#pragma once #pragma once
#include <time.h> #include <time.h>
#include <unistd.h>
#include <curl/curl.h> #include <curl/curl.h>
#include "manager.h" #include "manager.h"