Mercurial > pidgin
diff libpurple/log.c @ 21121:35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
a locale-specific string in the locale-specific encoding, which isn't
guaranteed to be UTF-8. g_strerror will always return a UTF-8 string.
I left gg and zephyr untouched, since gg doesn't include glib headers yet,
and zephyr does something weird with a #define for strerror. Someone more
familliar with those should take a look.
And the win32 guys should check and see if I screwed something up, since
they had strerror #defined to something else.
This should fix #2247 (and maybe some mystery crashes)
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 03 Nov 2007 17:52:28 +0000 |
parents | 6bf32c9e15a7 |
children | 03c950701fac |
line wrap: on
line diff
--- a/libpurple/log.c Sat Nov 03 17:04:25 2007 +0000 +++ b/libpurple/log.c Sat Nov 03 17:52:28 2007 +0000 @@ -756,7 +756,7 @@ if (!fwrite(image_data, image_byte_count, 1, image_file)) { purple_debug_error("log", "Error writing %s: %s\n", - path, strerror(errno)); + path, g_strerror(errno)); fclose(image_file); /* Attempt to not leave half-written files around. */ @@ -771,7 +771,7 @@ else { purple_debug_error("log", "Unable to create file %s: %s\n", - path, strerror(errno)); + path, g_strerror(errno)); } } @@ -1108,7 +1108,7 @@ return TRUE; else if (ret == -1) { - purple_debug_error("log", "Failed to delete: %s - %s\n", data->path, strerror(errno)); + purple_debug_error("log", "Failed to delete: %s - %s\n", data->path, g_strerror(errno)); } else { @@ -1143,7 +1143,7 @@ g_free(dirname); return TRUE; } - purple_debug_info("log", "access(%s) failed: %s\n", dirname, strerror(errno)); + purple_debug_info("log", "access(%s) failed: %s\n", dirname, g_strerror(errno)); g_free(dirname); #else /* Unless and until someone writes equivalent win32 code, @@ -1638,7 +1638,7 @@ if (!(index = g_fopen(pathstr, "rb"))) { purple_debug_error("log", "Failed to open index file \"%s\" for reading: %s\n", - pathstr, strerror(errno)); + pathstr, g_strerror(errno)); /* Fall through so that we'll parse the log file. */ } @@ -1675,7 +1675,7 @@ if (!(file = g_fopen(purple_stringref_value(pathref), "rb"))) { purple_debug_error("log", "Failed to open log file \"%s\" for reading: %s\n", - purple_stringref_value(pathref), strerror(errno)); + purple_stringref_value(pathref), g_strerror(errno)); purple_stringref_unref(pathref); g_free(pathstr); return NULL; @@ -1684,7 +1684,7 @@ index_tmp = g_strdup_printf("%s.XXXXXX", pathstr); if ((index_fd = g_mkstemp(index_tmp)) == -1) { purple_debug_error("log", "Failed to open index temp file: %s\n", - strerror(errno)); + g_strerror(errno)); g_free(pathstr); g_free(index_tmp); index = NULL; @@ -1692,7 +1692,7 @@ if ((index = fdopen(index_fd, "wb")) == NULL) { purple_debug_error("log", "Failed to fdopen() index temp file: %s\n", - strerror(errno)); + g_strerror(errno)); close(index_fd); if (index_tmp != NULL) { @@ -1828,7 +1828,7 @@ if (g_rename(index_tmp, pathstr)) { purple_debug_warning("log", "Failed to rename index temp file \"%s\" to \"%s\": %s\n", - index_tmp, pathstr, strerror(errno)); + index_tmp, pathstr, g_strerror(errno)); g_unlink(index_tmp); g_free(index_tmp); }