1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 18:53:12 +02:00

Fix bug with writing of configuration files when disk is full (bug #29331)

This commit is contained in:
Sebastien Helleu
2010-03-26 19:01:25 +01:00
parent 24135801b4
commit b9e65ec63d
28 changed files with 570 additions and 320 deletions
+10 -4
View File
@@ -1217,28 +1217,34 @@ string_iconv_from_internal (const char *charset, const char *string)
/*
* string_iconv_fprintf: encode to terminal charset, then call fprintf on a file
* return 1 if ok, 0 if error
*/
void
int
string_iconv_fprintf (FILE *file, const char *data, ...)
{
va_list argptr;
char *buf, *buf2;
int rc, num_written;
buf = malloc (128 * 1024);
if (!buf)
return;
return 0;
va_start (argptr, data);
vsnprintf (buf, 128 * 1024, data, argptr);
va_end (argptr);
buf2 = string_iconv_from_internal (NULL, buf);
fprintf (file, "%s", (buf2) ? buf2 : buf);
num_written = fprintf (file, "%s", (buf2) ? buf2 : buf);
rc = (num_written == (int)strlen ((buf2) ? buf2 : buf)) ? 1 : 0;
free (buf);
if (buf2)
free (buf2);
return rc;
}
/*