#! /bin/sh /usr/share/dpatch/dpatch-run
## 69_fix_oppolicy_startup_loading.patch by Mickael Marchand <mmarcha@ujf-grenoble.fr>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: fix loading of printer op-policy on startup

@DPATCH@
diff -u cupsys-1.2.7/cups/ipp.c cupsys-1.2.7.fixed/cups/ipp.c
--- cupsys-1.2.7/scheduler/printers.c	2006-09-19 22:11:08.000000000 +0200
+++ cupsys-1.2.7.fixed/scheduler/printers.c	2007-02-15 14:10:40.000000000 +0100
@@ -1186,8 +1186,14 @@
     }
     else if (!strcasecmp(line, "OpPolicy"))
     {
-      if (value)
+      if (value) {
         cupsdSetString(&p->op_policy, value);
+       /*
+        * Update the operation policy pointer...
+        */
+       if ((p->op_policy_ptr = cupsdFindPolicy(p->op_policy)) == NULL)
+         p->op_policy_ptr = DefaultPolicyPtr;
+      }
       else
       {
 	cupsdLogMessage(CUPSD_LOG_ERROR,

