mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Better error handling
Most of these will likely have no big impact, but it's better not to just ignore them as they could lead to crashes. Uemis downloader: if lseek fails, return 0 Uemis downloader: consistently check for failure to open req.txt Zip file handling: dup could fail Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
64c7202e2d
commit
90f20f4c76
2 changed files with 18 additions and 3 deletions
|
@ -808,9 +808,12 @@ void DivelogsDeWebServices::downloadFinished()
|
|||
zipFile.seek(0);
|
||||
#if defined(Q_OS_UNIX) && defined(LIBZIP_VERSION_MAJOR)
|
||||
int duppedfd = dup(zipFile.handle());
|
||||
struct zip *zip = zip_fdopen(duppedfd, 0, &errorcode);
|
||||
if (!zip)
|
||||
::close(duppedfd);
|
||||
struct zip *zip = NULL;
|
||||
if (duppedfd >= 0) {
|
||||
zip = zip_fdopen(duppedfd, 0, &errorcode);
|
||||
if (!zip)
|
||||
::close(duppedfd);
|
||||
}
|
||||
#else
|
||||
struct zip *zip = zip_open(QFile::encodeName(zipFile.fileName()), 0, &errorcode);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue