commit 367aa54c16cdfbe946d26c133083b2ae1d715791
parent 7eb6858477c1633c7957326edd6efe200cd091a5
Author: Ricardo Mones <ricardo@mones.org>
Date: Mon, 25 Nov 2013 20:20:00 +0100
Clean ‘newmail.c:132: warning: `sys_errlist' is deprecated’
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/plugins/newmail/newmail.c b/src/plugins/newmail/newmail.c
@@ -39,6 +39,7 @@
#define LOG_NAME "NewLog"
#define DEFAULT_DIR "Mail"
+#define BUFSIZE 2048
static guint hook_id;
@@ -128,9 +129,17 @@ gint plugin_init (gchar **error)
g_free(LogName);
LogName = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, LOG_NAME, NULL);
if (!(NewLog = fopen (LogName, mode))) {
+ char buf[BUFSIZE];
+
debug_print ("Failed to open fallback log %s\n", LogName);
+#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
+ strerror_r(errno, buf, BUFSIZE);
+ *error = g_strdup_printf(_("Could not open log file %s: %s\n"),
+ LogName, buf);
+#else /* use GNU version */
*error = g_strdup_printf(_("Could not open log file %s: %s\n"),
- LogName, sys_errlist[errno]);
+ LogName, strerror_r(errno, buf, BUFSIZE));
+#endif
plugin_done ();
return (-1);
}