If signing starts successfully, don't just turn it off automatically if
[jra/samba/.git] / source3 / printing / print_generic.c
index e1517c5dcb88a41172b30c9bdcfdd7169d9bbe68..9e0ea85bb9adcb6b0ad46e1ccd844649a9943fe0 100644 (file)
@@ -18,6 +18,7 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include "includes.h"
 #include "printing.h"
 
 
@@ -55,7 +56,7 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
 {
 
        pstring syscmd;
-       char *p, *arg;
+       char *arg;
        int ret;
        va_list ap;
        va_start(ap, outfd);
@@ -75,10 +76,8 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
        }
        va_end(ap);
   
-       p = PRINTERNAME(snum);
-  
-       pstring_sub(syscmd, "%p", p);
-       standard_sub_snum(snum,syscmd);
+       pstring_sub(syscmd, "%p", PRINTERNAME(snum));
+       standard_sub_snum(snum,syscmd,sizeof(syscmd));
 
        ret = smbrun(syscmd,outfd);
 
@@ -166,7 +165,7 @@ static int generic_job_submit(int snum, struct printjob *pjob)
        pstrcpy(jobname, pjob->jobname);
        pstring_sub(jobname, "'", "_");
        slprintf(job_page_count, sizeof(job_page_count)-1, "%d", pjob->page_count);
-       slprintf(job_size, sizeof(job_size)-1, "%d", pjob->size);
+       slprintf(job_size, sizeof(job_size)-1, "%lu", (unsigned long)pjob->size);
 
        /* send it to the system spooler */
        ret = print_run_command(snum, 
@@ -216,6 +215,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru
                queue = (print_queue_struct *)malloc(sizeof(print_queue_struct)*(numlines+1));
 
        if (queue) {
+               memset(queue, '\0', sizeof(print_queue_struct)*(numlines+1));
                for (i=0; i<numlines; i++) {
                        /* parse the line */
                        if (parse_lpq_entry(snum,qlines[i],