]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - ppdc/ppdc.cxx
Import changes from CUPS 1.4svn-r8704.
[thirdparty/cups.git] / ppdc / ppdc.cxx
index 2b006105f3573c34672471d45b7cd02cc2d8dc69..42d09fc0ebbad8b75b3c4aa8621cc9c3f8806254 100644 (file)
@@ -284,8 +284,7 @@ main(int  argc,                             // I - Number of command-line arguments
        if ((pid = fork()) == 0)
        {
          // Child process comes here...
-         close(0);
-         dup(fds[0]);
+         dup2(fds[0], 0);
 
          close(fds[0]);
          close(fds[1]);
@@ -357,12 +356,29 @@ main(int  argc,                           // I - Number of command-line arguments
       * Write the PPD file...
       */
 
-      if (d->write_ppd_file(fp, catalog, locales, src, le))
+      ppdcArray *templocales = locales;
+
+      if (!templocales)
+      {
+       templocales = new ppdcArray();
+       for (ppdcCatalog *tempcatalog = (ppdcCatalog *)src->po_files->first();
+            tempcatalog;
+            tempcatalog = (ppdcCatalog *)src->po_files->next())
+       {
+         tempcatalog->locale->retain();
+         templocales->add(tempcatalog->locale);
+       }
+      }
+
+      if (d->write_ppd_file(fp, catalog, templocales, src, le))
       {
        cupsFileClose(fp);
        return (1);
       }
 
+      if (templocales != locales)
+        templocales->release();
+
       cupsFileClose(fp);
     }
   }