Public bug reported:

Binary package hint: cups

calling ppdOpenFile  in below simple application will crash, printer
configure files provided.

#include <stdio.h>
#include <cups/cups.h>
#include <cups/ppd.h>
#include <pthread.h>
static pthread_mutex_t ppd_mutex  = {0,0,0};
static void init_ppd(void* printer_name)
{
        pthread_mutex_lock(&ppd_mutex);
        const char* pfilename = cupsGetPPD((char*)printer_name);
        ppd_file_t * ppdfile = ppdOpenFile(pfilename);
        printf("%s : %lld\n", (char*)printer_name, ppdfile);
        unlink(pfilename);
        pthread_mutex_unlock(&ppd_mutex);
        ppdClose(ppdfile);
}

ppd_file_t* pf[100];

int main()
{
        cups_dest_t* dests;
        int count = cupsGetDests( &dests);
        int i=0,j=0,k=0;
        pthread_t initThreads[100];
        for(j=0; j<2; j++)
        {
                for(i=0; i<count; i++)
                {
                        pthread_create(&initThreads[j*20+i], NULL, init_ppd, 
(void*) dests[i].name);
                }
        }
        sleep(10);
        printf("exit well\n");
}

** Affects: cups (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/736719

Title:
  ppdOpenFile crash on ubuntu 10.10

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to