evince/evince-2.31.5-synctex.patch
2010-07-16 10:31:44 +00:00

23 lines
1.0 KiB
Diff

--- evince-2.31.5/cut-n-paste/synctex/synctex_parser.c 2010-06-27 16:49:01.000000000 +0200
+++ evince-2.31.5/cut-n-paste/synctex/synctex_parser.c 2010-07-16 12:00:49.000000000 +0200
@@ -2549,6 +2549,7 @@ int __synctex_open(const char * output,
char * quoteless = NULL;
const char * mode = synctex_io_modes[io_mode];
size_t size = 0;
+ synctex_io_mode_t orig_io_mode = io_mode;
/* now create the synctex file name */
size = strlen(output)+strlen(synctex_suffix)+strlen(synctex_suffix_gz)+1;
synctex_name = (char *)malloc(size);
@@ -2565,6 +2566,11 @@ return_on_error:
synctex_name = NULL;/* Don't forget to reinitialize. */
the_file = NULL; /* Here as well */
free(quoteless);
+ /* We _must_ restore the original mode. Otherwise, in
+ case it had been "r", later changed to "rb", the next
+ call might use "rb" and "w" and _create_ the file, if
+ the caller is not avare of the change! */
+ io_mode = orig_io_mode;
return 2;
}
/* remove the last path extension if any */