From 284667c18fb8765d0c74d40c4d75b57feaed1a1f Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 18 Dec 2020 09:44:22 +0000 Subject: [PATCH] Fix BTG error reporting Use gzerror, not strerror, for these codes. --- simgear/io/sg_binobj.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simgear/io/sg_binobj.cxx b/simgear/io/sg_binobj.cxx index 5e4e5b1a..4d6180c1 100644 --- a/simgear/io/sg_binobj.cxx +++ b/simgear/io/sg_binobj.cxx @@ -566,8 +566,10 @@ bool SGBinObject::read_bin( const SGPath& file ) { sgReadUInt( fp, &header ); if (sgReadError()) { + int code = 0; + const char* gzErrorString = gzerror(fp, &code); gzclose(fp); - throw sg_io_exception("Unable to read BTG header: " + simgear::strutils::error_string(errno), sg_location(file)); + throw sg_io_exception("Unable to read BTG header: " + string{gzErrorString} + ", code =" + std::to_string(code), sg_location(file)); } if ( ((header & 0xFF000000) >> 24) == 'S' &&