diff options
Diffstat (limited to 'Build/source/texk/bibtex8/utils.c')
-rw-r--r-- | Build/source/texk/bibtex8/utils.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Build/source/texk/bibtex8/utils.c b/Build/source/texk/bibtex8/utils.c index dc9b801aaac..f5df8eb556f 100644 --- a/Build/source/texk/bibtex8/utils.c +++ b/Build/source/texk/bibtex8/utils.c @@ -191,7 +191,7 @@ static struct option long_options[] = { {0, 0, 0, 0} }; -static char *getopt_str = "78c:d:?stvBHM:W"; +static const char *getopt_str = "78c:d:?stvBHM:W"; @@ -448,10 +448,10 @@ void close_file (const AlphaFile_T file_pointer) ** appropriate debugging option has been selected. **============================================================================ */ -void debug_msg (const int status, char *printf_fmt, ...) +void debug_msg (const int status, const char *printf_fmt, ...) { va_list printf_args; - char *prefix; + const char *prefix; switch (status) { case DBG_CSF: @@ -733,6 +733,8 @@ FILE *open_ip_file (Integer_T search_path) debug_msg (DBG_IO, "open_ip_file: trying to open `%s' ... ", full_filespec); #ifdef KPATHSEA + if (!kpse_in_name_ok(full_filespec)) + goto not_ok; fptr = fopen (full_filespec, FOPEN_R_MODE); free (full_filespec); #else @@ -750,6 +752,7 @@ FILE *open_ip_file (Integer_T search_path) ** Otherwise, return a NULL pointer. */ else { +not_ok: debug_msg (DBG_IO, "open_ip_file: unable to open `%s' ... ", full_filespec); fptr = NULL; @@ -784,7 +787,10 @@ FILE *open_op_file (void) ** varies according to the operating system. */ #if defined(KPATHSEA) - fptr = fopen(tmp_file_name, FOPEN_W_MODE); + if (kpse_out_name_ok(tmp_file_name)) + fptr = fopen(tmp_file_name, FOPEN_W_MODE); + else + fptr = NULL; #else # if defined(MSDOS) || defined(OS2) fptr = fopen (tmp_file_name, "wt"); @@ -1322,7 +1328,7 @@ void set_array_sizes (void) ** provided, this is displayed first. **============================================================================ */ -void usage (char *printf_fmt, ...) +void usage (const char *printf_fmt, ...) { va_list printf_args; |