From ad33d498c709d2a2f9419e59977ba1c83b0518db Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 1 May 2024 16:56:28 +0200 Subject: [PATCH] uemis: unglobalize reqtxt_file This global variable is used in two function independently of each other. I don't see how there should be transport of this value from one function to the other. Ominous. Signed-off-by: Berthold Stoeger --- core/uemis-downloader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/uemis-downloader.cpp b/core/uemis-downloader.cpp index 41fe5f74d..1511ba4b6 100644 --- a/core/uemis-downloader.cpp +++ b/core/uemis-downloader.cpp @@ -78,7 +78,6 @@ static int debug_round = 0; static uemis uemis_obj; static std::array param_buff; static std::string reqtxt_path; -static int reqtxt_file; static int filenr; static int number_of_files; @@ -338,7 +337,7 @@ static bool uemis_init(const std::string &path) return false; /* let's check if this is indeed a Uemis DC */ reqtxt_path = build_filename(path, "req.txt"s); - reqtxt_file = subsurface_open(reqtxt_path.c_str(), O_RDONLY | O_CREAT, 0666); + int reqtxt_file = subsurface_open(reqtxt_path.c_str(), O_RDONLY | O_CREAT, 0666); if (reqtxt_file < 0) { #if UEMIS_DEBUG & 1 report_info(":EE req.txt can't be opened\n"); @@ -544,7 +543,7 @@ static std::string uemis_get_answer(const char *path, const std::string &request int ans_file; int timeout = UEMIS_LONG_TIMEOUT; - reqtxt_file = subsurface_open(reqtxt_path.c_str(), O_RDWR | O_CREAT, 0666); + int reqtxt_file = subsurface_open(reqtxt_path.c_str(), O_RDWR | O_CREAT, 0666); if (reqtxt_file < 0) { error_text = "can't open req.txt"; #ifdef UEMIS_DEBUG