star-hitran

Load line-by-line data from the HITRAN database
git clone git://git.meso-star.fr/star-hitran.git
Log | Files | Refs | README | LICENSE

commit 08240bde359b290d3a8a790d23a2e443b305cda6
parent 9729474133f1b72bcb200c0eeb1cefe586cdf5f7
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 12 Feb 2026 12:22:58 +0100

Improve the error message when writing a tree

Print the error reported by libc, instead of its translation into an
error code returned by the serialization function. This will provide
details of what went wrong at the system level.

Note that the deserialization function displays the error as reported by
the function's return code, not the libc error. This is because in this
situation, the end of the file can be reached without being considered
an error, even though it is indeed an error from the function's point of
view.

Diffstat:
Msrc/shtr_line_list.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/shtr_line_list.c b/src/shtr_line_list.c @@ -713,10 +713,9 @@ shtr_line_list_write #define WRITE(Var, Nb) { \ if(fwrite((Var), sizeof(*(Var)), (Nb), stream.fp) != (Nb)) { \ + ERROR(list->shtr, "%s:%s: error writing line list -- %s\n", \ + FUNC_NAME, stream.name, strerror(errno)); \ res = RES_IO_ERR; \ - ERROR(list->shtr, \ - "%s:%s: error writing line list -- %s\n", \ - FUNC_NAME, stream.name, res_to_cstr(res)); \ goto error; \ } \ } (void)0