uemis downloader: close reqtxt_file in case of error

Found by Coverity. Should switch to proper C++ type, though
no priority for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-08-14 09:34:39 +02:00 committed by Michael Keller
parent a3340298b6
commit f78662acce

View file

@ -285,14 +285,18 @@ static bool uemis_init(const std::string &path)
}
if (bytes_available(reqtxt_file) > 5) {
char tmp[6];
if (read(reqtxt_file, tmp, 5) != 5)
if (read(reqtxt_file, tmp, 5) != 5) {
close(reqtxt_file);
return false;
}
tmp[5] = '\0';
#if UEMIS_DEBUG & 2
report_info("::r req.txt \"%s\"\n", tmp);
#endif
if (sscanf(tmp + 1, "%d", &filenr) != 1)
if (sscanf(tmp + 1, "%d", &filenr) != 1) {
close(reqtxt_file);
return false;
}
} else {
filenr = 0;
#if UEMIS_DEBUG & 2