Summary: Poor error reporting on failure to open file
Submitted by: jtn
Submitted on: Sun 06 Jul 2014 12:47:19 BST
Severity: 3 - Normal
Priority: 5 - Normal
Assigned to: None
Discussion Lock: Any
Operating System: None
If a data file isn't present, has no permissions, etc, secfile_error() doesn't
return anything useful (a blank string when I tried).
Fixing this will be quite tedious:
secfile_load()/secfile_load_section() call inf_from_file() in inputfile, which
doesn't have a defined ferror/errno/strerror-type interface.
inf_from_file() calls fz_from_file(), which kind of has such an interface
(fz_strerror()), although it relies on the regular errno which won't be set
for compression-related errors. Also, it's not set for all OS errors.
For instance, support.c:is_reg_file_for_access() can return FALSE for a
non-errno condition, so fz_from_file() can't simply call strerror(), hence we
don't trivially get "file not found" vs "permission denied" in fz_strerror().
Fixing this will require a usable error reporting interface at every layer in
this stack, so that we can get "file not found" from the OS all the way to
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list