Set errno to 0 before doing disk I/O to prevent confusing error

messages on save failure.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5395 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2010-11-10 18:19:20 +00:00
parent cc98fdb528
commit 6cfea4b550
2 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,9 @@
data/filetypes.xml, data/filetypes.html:
Add xml_indent_tags filetype setting for documents using the
HTML/XML lexers (patch by Eugene Arshinov, thanks).
* src/document.c:
Set errno to 0 before doing disk I/O to prevent confusing error
messages on save failure.
2010-11-09 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -1730,11 +1730,13 @@ static gchar *write_data_to_disk(const gchar *locale_filename,
gboolean fail = FALSE;
/* Use POSIX API for unsafe saving (GVFS-unsafe) */
errno = 0;
fp = g_fopen(locale_filename, "wb");
if (fp == NULL)
fail = TRUE;
else
{
errno = 0;
bytes_written = fwrite(data, sizeof(gchar), len, fp);
if (len != bytes_written)