File cups-1.2.0-ppdsdat_generation-adapted_for_cups-1.3.9_with_fuzz0.patch of Package cups
--- scheduler/main.c.orig 2008-09-07 23:58:01.000000000 +0200
+++ scheduler/main.c 2010-08-19 15:30:29.000000000 +0200
@@ -173,6 +173,7 @@ main(int argc, /* I - Number of comm
*/
fg = 0;
+ ppds_generation = 0;
#ifdef HAVE_LAUNCHD
if (getenv("CUPSD_LAUNCHD"))
@@ -275,6 +276,10 @@ main(int argc, /* I - Number of comm
fg = 1;
break;
+ case 'P' : /* generate ppds only */
+ ppds_generation = 1;
+ break;
+
default : /* Unknown option */
_cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - "
"aborting!\n"), *opt);
@@ -343,17 +348,18 @@ main(int argc, /* I - Number of comm
perror("cupsd");
return (1);
}
- else if (WIFEXITED(i))
+ else if (!ppds_generation && WIFEXITED(i))
{
fprintf(stderr, "cupsd: Child exited with status %d!\n",
WEXITSTATUS(i));
return (2);
}
- else
+ else if (!ppds_generation || WTERMSIG(i)!=0)
{
fprintf(stderr, "cupsd: Child exited on signal %d!\n", WTERMSIG(i));
return (3);
- }
+ } else
+ return (0);
}
#ifdef __APPLE__
@@ -596,6 +602,9 @@ main(int argc, /* I - Number of comm
}
#endif /* __sgi */
+ if (ppds_generation > 0)
+ return (stop_scheduler);
+
/*
* Initialize authentication certificates...
*/
@@ -2001,13 +2010,14 @@ static void
usage(int status) /* O - Exit status */
{
_cupsLangPuts(status ? stderr : stdout,
- _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l]\n"
+ _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l] [-P]\n"
"\n"
"-c config-file Load alternate configuration file\n"
"-f Run in the foreground\n"
"-F Run in the foreground but detach\n"
"-h Show this usage message\n"
- "-l Run cupsd from launchd(8)\n"));
+ "-l Run cupsd from launchd(8)\n"
+ "-P Generate ppds.dat and exit\n"));
exit(status);
}
--- scheduler/cupsd.h.orig 2008-02-16 00:26:51.000000000 +0100
+++ scheduler/cupsd.h 2010-08-19 15:30:29.000000000 +0200
@@ -180,6 +180,8 @@ VAR PSQUpdateQuotaProcPtr PSQUpdateQuota
+VAR int ppds_generation;/* Generate ppds.dat and exit() */
+
/*
* Prototypes...
--- scheduler/conf.c.orig 2008-09-07 23:58:01.000000000 +0200
+++ scheduler/conf.c 2010-08-19 15:30:29.000000000 +0200
@@ -871,6 +871,9 @@ cupsdReadConfiguration(void)
return (0);
}
+ if (ppds_generation > 0)
+ return(1);
+
/*
* Setup environment variables...
*/