mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 15:22:20 +02:00
gnss: truncate temporary file before download
A temporary file is used to download the GNSS assistance data. It's created and truncated at initialization, but not truncated when a re-upload is necessary (when data expires). This causes to corrupt the GNSS assistance data if the new downloaded data is smaller than the previous download.
This commit is contained in:
@@ -191,6 +191,8 @@ static void fetch_assistance_data(struct EG25Manager *manager)
|
|||||||
|
|
||||||
/* 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();
|
||||||
|
@@ -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"
|
||||||
|
Reference in New Issue
Block a user