a2ps-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixe SEGV when use one delegated job and one or more failled jobs.


From: Franck Lombardi
Subject: Fixe SEGV when use one delegated job and one or more failled jobs.
Date: Thu, 3 Oct 2002 17:10:44 +0200
User-agent: KMail/1.4.3

In this sample : 
a2ps foo.deleg bar.none
foo.deleg is a delegated job and bar.none don't exist

This sample SEGV, because a2ps has only been used to delegate a single job. 
And in this case we work with "CURRENT_FILE (job)". If a failed job is after 
the delegated job, CURRENT_FILE (job) == the failed job.

My solution is find the last job who don't a failed job.

A other solution is to del the failed job when it is detected as a failed job 
but it is a more big patch.

Index: ChangeLog
from  Franck Lombardi  <address@hidden>

        * src/main.c: Fixe SEGV when use one delegated job and one
        or more failled jobs.

Index: src/main.c
===================================================================
RCS file: /cvsroot/a2ps/a2ps/src/main.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 main.c
--- src/main.c 4 Mar 2002 18:46:28 -0000 1.1.1.1
+++ src/main.c 3 Oct 2002 14:58:59 -0000
@@ -1176,10 +1176,23 @@
             * in is this one!
             * To this end, we need to put more information in file_job
             * on how its processing went. */
+           
+           struct file_job * file_job;
+           size_t len;
+           
+           /* 'delegation_tmpname' is necessary not null else it is a
+              failed job and we ignore it */
+           file_job = CURRENT_FILE (job);
+           len = job->jobs->len;
+           while (!file_job->delegation_tmpname)
+             {
+               len--;
+               file_job = job->jobs->content[len - 1];
+             }
+           
            a2ps_open_output_stream (job);
-           pslex_dump (job->output_stream->fp,
-                       CURRENT_FILE (job)->delegation_tmpname);
-           unlink (CURRENT_FILE (job)->delegation_tmpname);
+           pslex_dump (job->output_stream->fp, file_job->delegation_tmpname);
+           unlink (file_job->delegation_tmpname);
            a2ps_close_output_stream (job);
            msg_job_pages_printed (job);
          }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]