diff options
author | Karl Berry <karl@freefriends.org> | 2010-02-26 01:26:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-02-26 01:26:20 +0000 |
commit | e4b8436c05bf748b5ed72b08dd4ec9fdbb9e40d5 (patch) | |
tree | fa7b268fac2b93d09dbad460aee7766a1842b465 /Build/source/texk/dvipsk | |
parent | 9b44e2a9649f9e06bc97fb539eb3d38c4f7c5645 (diff) |
remove kpse_ prefix on new safeness functions, until we figure out where to use them elsewhere
git-svn-id: svn://tug.org/texlive/trunk@17211 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipsk')
-rw-r--r-- | Build/source/texk/dvipsk/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/search.c | 47 |
2 files changed, 31 insertions, 22 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index f7b270ccf99..8fb408fca49 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,9 @@ +2010-02-26 Karl Berry <karl@tug.org> + + * search.c (selfautoloc_prog, quote_name): remove kpse_ prefix for + the time being, since it seems web2c's safeness stuff can't be + easily factored into using them. + 2010-02-23 Peter Breitenlohner <peb@mppmu.mpg.de> * search.c: #include <kpathsea/variable.h> for kpse_var_value. diff --git a/Build/source/texk/dvipsk/search.c b/Build/source/texk/dvipsk/search.c index c7b7300388f..16a930293cf 100644 --- a/Build/source/texk/dvipsk/search.c +++ b/Build/source/texk/dvipsk/search.c @@ -29,7 +29,9 @@ char *realnameoffile ; /* Return safely quoted version of NAME. That means using "..." on Windows and '...' on Unix, with any occurrences of the quote char - quoted with a \. Result is always in new memory; NAME is unchanged. */ + quoted with a \. Result is always in new memory; NAME is unchanged. + This is a generic function; if we end up needing it in other + programs, we should move it to kpathsea. */ #ifdef WIN32 #define QUOTE '"' @@ -38,7 +40,7 @@ char *realnameoffile ; #endif static char * -kpse_quote_name (const char *name) +quote_name (const char *name) { char *quoted = xmalloc (strlen (name) * 2 + 3); char *q = quoted; @@ -63,10 +65,13 @@ kpse_quote_name (const char *name) This is necessary because Windows likes to run programs out of the current directory. So for security, we want to ensure that we are - invoking programs from our own binary directory, not via PATH. */ + invoking programs from our own binary directory, not via PATH. + + This is a generic function; if we end up needing it in other + programs, we should move it to kpathsea. */ static char * -kpse_selfautoloc_prog (const char *prog) +selfautoloc_prog (const char *prog) { char *ret; #ifdef WIN32 @@ -136,9 +141,9 @@ search(kpse_file_format_type format, const char *file, const char *mode) && ((len > 2 && FILESTRCASEEQ (found_name + len - 2, ".Z")) || (len > 3 && FILESTRCASEEQ (found_name + len - 3, ".gz")))) { /* automatically but safely decompress. */ - char *quoted_name = kpse_quote_name (found_name); + char *quoted_name = quote_name (found_name); char *cmd; - char *prog = kpse_selfautoloc_prog (GUNZIP); + char *prog = selfautoloc_prog (GUNZIP); cmd = concat3 (prog, " -c ", quoted_name); ret = popen (cmd, "r"); to_close = USE_PCLOSE; @@ -175,23 +180,21 @@ pksearch(const char *file, const char *mode, halfword dpi, kpse_glyph_file_type font_file; string found_name = kpse_find_pk (file, dpi, &font_file); - if (found_name) - { - ret = fopen (found_name, mode); - if (!ret) - FATAL_PERROR (name); + if (found_name) { + ret = fopen (found_name, mode); + if (!ret) + FATAL_PERROR (name); - /* Free result of previous search. */ - if (realnameoffile) - free (realnameoffile); - /* Save in `name' and `realnameoffile' because other routines - access those globals. Sigh. */ - realnameoffile = found_name; - strcpy(name, realnameoffile); - *name_ret = font_file.name; - *dpi_ret = font_file.dpi; - } - else + /* Free result of previous search. */ + if (realnameoffile) + free (realnameoffile); + /* Save in `name' and `realnameoffile' because other routines + access those globals. Sigh. */ + realnameoffile = found_name; + strcpy(name, realnameoffile); + *name_ret = font_file.name; + *dpi_ret = font_file.dpi; + } else ret = NULL; return ret; |