summaryrefslogtreecommitdiff
path: root/office/zathura-cb/glib228compat.diff
diff options
context:
space:
mode:
Diffstat (limited to 'office/zathura-cb/glib228compat.diff')
-rw-r--r--office/zathura-cb/glib228compat.diff59
1 files changed, 59 insertions, 0 deletions
diff --git a/office/zathura-cb/glib228compat.diff b/office/zathura-cb/glib228compat.diff
new file mode 100644
index 0000000000..20b9b5a59c
--- /dev/null
+++ b/office/zathura-cb/glib228compat.diff
@@ -0,0 +1,59 @@
+diff -Naur zathura-cb-0.1.0/cb.c zathura-cb-0.1.0.patched/cb.c
+--- zathura-cb-0.1.0/cb.c 2012-06-09 17:48:13.000000000 -0400
++++ zathura-cb-0.1.0.patched/cb.c 2012-07-22 15:06:18.000000000 -0400
+@@ -1,7 +1,9 @@
+ /* See LICENSE file for license and copyright information */
+
+-#include <stdlib.h>
+ #include <stdio.h>
++#include <unistd.h>
++#include <limits.h>
++#include <stdlib.h>
+ #include <glib.h>
+ #include <gtk/gtk.h>
+ #include <glib/gstdio.h>
+@@ -11,7 +13,7 @@
+ #include "utils.h"
+
+ struct cb_document_s {
+- char* directory; /**< Path to the directory */
++ char directory[4096]; /**< Path to the directory */
+ girara_list_t* page_paths; /**< List of page paths */
+ };
+
+@@ -58,8 +60,8 @@
+ cb_document_t* cb_document = g_malloc0(sizeof(cb_document));
+
+ /* create temp directory */
+- cb_document->directory = g_dir_make_tmp("zathura-cb-XXXXXX", NULL);
+- if (cb_document->directory == NULL) {
++ sprintf(cb_document->directory, "%s/zathura-cb-XXXXXX", g_get_tmp_dir());
++ if(mkdtemp(cb_document->directory) == NULL) {
+ goto error_free;
+ }
+
+@@ -148,18 +150,18 @@
+ return ZATHURA_ERROR_INVALID_ARGUMENTS;
+ }
+
+- /* remove temp directory */
+- if (cb_document->directory != NULL) {
+- g_remove(cb_document->directory);
+- }
+-
+ /* remove page list */
+ if (cb_document->page_paths != NULL) {
++ char *path;
++ GIRARA_LIST_FOREACH(cb_document->page_paths, char*, iter, path)
++ g_remove(path);
++ GIRARA_LIST_FOREACH_END(cb_document->page_paths, char*, iter, path);
+ girara_list_free(cb_document->page_paths);
+ }
+
++ /* remove temp directory */
+ if (cb_document->directory != NULL) {
+- g_free(cb_document->directory);
++ g_remove(cb_document->directory);
+ }
+
+ g_free(cb_document);