diff options
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 19 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index a7a08288a07..35f2bdd9de4 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,8 +1,14 @@ +2022-03-03 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * texmfmp.c: Convert the argument of runpopen to utf8 for pTeX. + https://github.com/texjporg/tex-jp-build/issues/81 + 2022-01-22 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> * openclose.c (open_input): Reencode nameoffile to utf8 for pTeX. * texmfmp.c: Change type of str_pool to unsigned short for pTeX. We use only 0--511, and use flag 0x100 for Japanese char. + https://github.com/texjporg/tex-jp-build/issues/81 2022-01-01 Akira Kakuto <kakuto@jcom.zaq.ne.jp> diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index a50b9b5ac2f..c589244d93a 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -667,6 +667,9 @@ runpopen (char *cmd, const char *mode) char *safecmd = NULL; char *cmdname = NULL; int allow; +#if IS_pTeX && !defined(WIN32) + char *cmd2 = NULL; +#endif #ifdef WIN32 char *pp; @@ -676,14 +679,27 @@ runpopen (char *cmd, const char *mode) } #endif +#if IS_pTeX && !defined(WIN32) + cmd2 = (char *)ptenc_from_internal_enc_string_to_utf8((unsigned char *)cmd); + if (!cmd2) cmd2=(char *)cmd; +#endif + /* If restrictedshell == 0, any command is allowed. */ if (restrictedshell == 0) allow = 1; else +#if IS_pTeX && !defined(WIN32) + allow = shell_cmd_is_allowed (cmd2, &safecmd, &cmdname); +#else allow = shell_cmd_is_allowed (cmd, &safecmd, &cmdname); +#endif if (allow == 1) +#if IS_pTeX && !defined(WIN32) + f = popen (cmd2, mode); +#else f = popen (cmd, mode); +#endif else if (allow == 2) f = popen (safecmd, mode); else if (allow == -1) @@ -692,6 +708,9 @@ runpopen (char *cmd, const char *mode) else fprintf (stderr, "\nrunpopen command not allowed: %s\n", cmdname); +#if IS_pTeX && !defined(WIN32) + if (cmd!=cmd2) free(cmd2); +#endif if (safecmd) free (safecmd); if (cmdname) |