[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1566-gddddd71

[email protected] (Ray Johnston)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  ddddd71785d058b036775566d36d6848c9817f80 (commit)
      from  3eb2b1337260a17274588d377032e1f9953062fd (commit)

----------------------------------------------------------------------
commit ddddd71785d058b036775566d36d6848c9817f80
Author: Ray Johnston <[email protected]>
Date:   Wed Aug 14 08:03:45 2019 -0700

    Fix -F____ and -f____ to actually run the file ____.
    
    Commit 7ecbfda9 broke -F completely since it requires the file to run to
    immediately follow the switch, and -f____ use to run the file, but since
    gs_add_control_path returns 0 as long as there was no error, the code
    never called argproc. Also, argproc already does the add_control_path
    and remove_control_path, so simplify -f and -F code.
    
    Also gs_add_outputfile_control_path was ignoring the return code when
    adding the full pipe string as a path, so fix it.
    
    Note that plmain ignores the return code from gs_remove_control_path,
    but that should be OK.

diff --git a/base/gslibctx.c b/base/gslibctx.c
index aef6c70..d4ccb2c 100644
--- a/base/gslibctx.c
+++ b/base/gslibctx.c
@@ -593,6 +593,8 @@ gs_add_outputfile_control_path(gs_memory_t *mem, const char *fname)
         fp = f;
         for (i = 0; i < len; i++) {
             if (f[i] == pipe) {
+               int code;
+
                fp = &f[i + 1];
                /* Because we potentially have to check file permissions at two levels
                   for the output file (gx_device_open_output_file and the low level
@@ -600,7 +602,9 @@ gs_add_outputfile_control_path(gs_memory_t *mem, const char *fname)
                   (including the '|', and just the command to which we pipe - since at
                   the pipe_fopen(), the leading '|' has been stripped.
                 */
-               gs_add_control_path(mem, gs_permit_file_writing, f);
+               code = gs_add_control_path(mem, gs_permit_file_writing, f);
+               if (code < 0)
+                   return code;
                break;
             }
             if (!IS_WHITESPACE(f[i]))
diff --git a/psi/imainarg.c b/psi/imainarg.c
index 67bccec..4e2cdab 100644
--- a/psi/imainarg.c
+++ b/psi/imainarg.c
@@ -536,10 +536,7 @@ run_stdin:
             }
         case 'f':               /* run file of arbitrary name */
             if (*arg != 0) {
-                code = gs_add_control_path(minst->heap, gs_permit_file_reading, arg);
-                if (code > 0)
-                    code = argproc(minst, arg);
-                (void)gs_remove_control_path(minst->heap, gs_permit_file_reading, arg);
+                code = argproc(minst, arg);
                 if (code < 0)
                     return code;
                 /* If in saved_pages_test_mode, print and flush previous job before the next file */
@@ -574,10 +571,7 @@ run_stdin:
                 uint bsize = minst->run_buffer_size;
 
                 minst->run_buffer_size = 1;
-                code = gs_add_control_path(minst->heap, gs_permit_file_reading, arg);
-                if (code > 0)
-                    code = argproc(minst, arg);
-                (void)gs_remove_control_path(minst->heap, gs_permit_file_reading, arg);
+                code = argproc(minst, arg);
                 minst->run_buffer_size = bsize;
                 if (code < 0)
                     return code;


Summary of changes:
 base/gslibctx.c |  6 +++++-
 psi/imainarg.c  | 10 ++--------
 2 files changed, 7 insertions(+), 9 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.