summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorAnton Danilkin <afdw@yandex.ru>2021-05-03 23:38:28 +0200
committerAnton Danilkin <afdw@yandex.ru>2021-05-03 23:38:28 +0200
commit9e497a3cb82a429a04dbbce8debeba5e0e37cf29 (patch)
treef0b81ade55a64c6ddb272ebc7dcfd670db03bb33 /boilerplate
parent42128f1742050428dbe9f4570c1d57d64e7975c0 (diff)
downloadcairo-9e497a3cb82a429a04dbbce8debeba5e0e37cf29.tar.gz
Introduce CAIRO_BOILERPLATE_OPEN_NO_DAEMON and CAIRO_BOILERPLATE_DO_NOT_CRASH_ON_ANY2PPM_ERROR
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 383606177..024870a83 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -944,7 +944,7 @@ POPEN:
*close_cb = pclose;
sprintf (command, "%s %s %d", any2ppm, filename, page);
- return popen (command, "rb");
+ return popen (command, "r");
}
static cairo_bool_t
@@ -1040,6 +1040,10 @@ cairo_boilerplate_convert_to_image (const char *filename,
int (*close_cb) (FILE *);
int ret;
+ if (getenv ("CAIRO_BOILERPLATE_OPEN_NO_DAEMON") != NULL) {
+ flags |= CAIRO_BOILERPLATE_OPEN_NO_DAEMON;
+ }
+
RETRY:
file = cairo_boilerplate_open_any2ppm (filename, page, flags, &close_cb);
if (file == NULL) {
@@ -1056,7 +1060,11 @@ cairo_boilerplate_convert_to_image (const char *filename,
/* check for fatal errors from the interpreter */
if (ret) { /* any2pmm should never die... */
cairo_surface_destroy (image);
- return cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_INVALID_STATUS);
+ if (getenv ("CAIRO_BOILERPLATE_DO_NOT_CRASH_ON_ANY2PPM_ERROR") != NULL) {
+ return cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_WRITE_ERROR);
+ } else {
+ return cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_INVALID_STATUS);
+ }
}
if (ret == 0 && cairo_surface_status (image) == CAIRO_STATUS_READ_ERROR) {