From 367aa54c16cdfbe946d26c133083b2ae1d715791 Mon Sep 17 00:00:00 2001 From: Ricardo Mones Date: Mon, 25 Nov 2013 20:20:00 +0100 Subject: [PATCH] =?utf8?q?Clean=20=E2=80=98newmail.c:132:=20warning:=20`sy?= =?utf8?q?s=5Ferrlist'=20is=20deprecated=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/plugins/newmail/newmail.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/newmail/newmail.c b/src/plugins/newmail/newmail.c index 54004a52c..db8c57eca 100644 --- 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); } -- 2.25.1