[gimp/gimp-2-8] plug-ins: use standard error on failed file descriptor in file-pdf-save.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] plug-ins: use standard error on failed file descriptor in file-pdf-save.
- Date: Tue, 29 Jul 2014 15:08:33 +0000 (UTC)
commit 71bf6c46f18f3c038afa5b58b59977de34b2ea53
Author: Jehan <jehan girinstud io>
Date: Tue Jul 29 16:55:01 2014 +0000
plug-ins: use standard error on failed file descriptor in file-pdf-save.
The standard message used all over our code is:
"Could not open '%s' for writing: %s".
(cherry picked from commit 4ae597c586f309d5268ef39ceac5a5adafd329e7)
plug-ins/common/file-pdf-save.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c
index c792fae..8144e8b 100644
--- a/plug-ins/common/file-pdf-save.c
+++ b/plug-ins/common/file-pdf-save.c
@@ -102,6 +102,8 @@
#include "config.h"
+#include <errno.h>
+
#include <glib/gstdio.h>
#include <cairo-pdf.h>
#include <pango/pangocairo.h>
@@ -426,7 +428,17 @@ run (const gchar *name,
fp = g_fopen (file_name, "wb");
if (fp == NULL)
{
+ *nreturn_vals = 2;
+
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
+ values[1].type = GIMP_PDB_STRING;
+ if (error == NULL)
+ {
+ g_set_error (&error, G_FILE_ERROR, g_file_error_from_errno (errno),
+ _("Could not open '%s' for writing: %s"),
+ gimp_filename_to_utf8 (file_name), g_strerror (errno));
+ }
+ values[1].data.d_string = error->message;
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]