Print strerror when failing to open a report file

This commit is contained in:
Snaipe 2015-11-27 12:24:42 +01:00
parent 07f109eb6e
commit 11b84284f7
2 changed files with 12 additions and 9 deletions

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: criterion 2.0.0\n"
"Report-Msgid-Bugs-To: franklinmathieu+criterion@gmail.com\n"
"POT-Creation-Date: 2015-11-27 12:16+0100\n"
"POT-Creation-Date: 2015-11-27 12:24+0100\n"
"PO-Revision-Date: 2015-04-03 17:58+0200\n"
"Last-Translator: <franklinmathieu@gmail.com>\n"
"Language-Team: French\n"
@ -207,12 +207,13 @@ msgstr ""
"nombre de tâches est explicitement défini. Les rapports d'erreur risquent "
"d'être déroutants!%2$s\n"
#: src/io/output.c:12
#, c-format
msgid "Could not open the file @ `%1$s` for %2$s reporting.\n"
msgstr "Impossible d'ouvrir le fichier `%1$s` pour faire le rapport %2$s.\n"
#: src/io/output.c:13
#, fuzzy, c-format
msgid "Could not open the file @ `%1$s` for %2$s reporting: %3$s.\n"
msgstr ""
"Impossible d'ouvrir le fichier `%1$s` pour faire le rapport %2$s: %3$s.\n"
#: src/io/output.c:14
#, c-format
msgid "Writing %1$s report in `%2$s`.\n"
msgstr "Écriture du rapport %1$s dans `%2$s`.\n"

View file

@ -2,6 +2,7 @@
#include <string.h>
#include <khash.h>
#include <kvec.h>
#include <errno.h>
#include "criterion/output.h"
#include "criterion/logging.h"
#include "string/i18n.h"
@ -9,10 +10,10 @@
typedef const char *const msg_t;
#ifdef ENABLE_NLS
static msg_t msg_err = N_("Could not open the file @ `%1$s` for %2$s reporting.\n");
static msg_t msg_err = N_("Could not open the file @ `%1$s` for %2$s reporting: %3$s.\n");
static msg_t msg_ok = N_("Writing %1$s report in `%2$s`.\n");
#else
static msg_t msg_err = "Could not open the file @ `%s` for %s reporting.\n";
static msg_t msg_err = "Could not open the file @ `%s` for %s reporting: %s.\n";
static msg_t msg_ok = "Writing %s report in `%s`.\n";
#endif
@ -97,7 +98,8 @@ void process_all_output(struct criterion_global_stats *stats) {
f = fopen(path, "w");
if (!f) {
criterion_perror(_(msg_err), path, name);
int errno2 = errno;
criterion_perror(_(msg_err), path, name, strerror(errno2));
continue;
}