After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 731305 - gfileutils.c error handling broken
gfileutils.c error handling broken
Status: RESOLVED DUPLICATE of bug 725514
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal major
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-06-06 01:38 UTC by Morten Welinder
Modified: 2017-10-05 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morten Welinder 2014-06-06 01:38:52 UTC
gfileutils.c makes heavy use of utility function set_file_error.
While that function work, none of the calls to it are correct.

Here's a sample call:

      set_file_error (error,
                      filename,
                      _("Failed to open file '%s': %s"));

The problem is that gettext (aka "_") can change errno at will.
Here's what that call should have looked like:

      int save_errno = errno;
      const char *fmt = _("Failed to open file '%s': %s");
      errno = save_errno;
      set_file_error (error, filename, fmt);

That looks crazy, so I would suggest to use N_(...) instead of _(...)
and have set_file_error call _.  For that to work right, format_error_message
would need to have the error number as an argument.
Comment 1 Philip Withnall 2017-10-05 13:01:54 UTC
This was fixed in commit 6680ff1ee93127b247f8ca32958620ec7db6af48 (bug #725514).

*** This bug has been marked as a duplicate of bug 725514 ***