URL:
  <http://gna.org/bugs/?22283>

                 Summary: Poor error reporting on failure to open file
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Sun 06 Jul 2014 12:47:19 BST
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: None
         Planned Release: 

    _______________________________________________________

Details:

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
secfile_error().




    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?22283>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to