*pp_cache = NULL;
}
-bool pcap_cache_add(const char *name, const char *comment, const char *location)
+static bool pcap_cache_add(const char *name, const char *comment, const char *location)
{
NTSTATUS status;
time_t t = time_mono(NULL);
{
const char *pcap_name = lp_printcapname();
bool pcap_reloaded = False;
- NTSTATUS status;
bool post_cache_fill_fn_handled = false;
+ struct pcap_cache *pcache = NULL;
DEBUG(3, ("reloading printcap cache\n"));
return;
}
- status = printer_list_mark_reload();
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to mark printer list for reload!\n"));
- return;
- }
-
#ifdef HAVE_CUPS
if (strequal(pcap_name, "cups")) {
pcap_reloaded = cups_cache_reload(ev, msg_ctx,
#ifdef HAVE_IPRINT
if (strequal(pcap_name, "iprint")) {
- pcap_reloaded = iprint_cache_reload();
+ pcap_reloaded = iprint_cache_reload(&pcache);
goto done;
}
#endif
#if defined(SYSV) || defined(HPUX)
if (strequal(pcap_name, "lpstat")) {
- pcap_reloaded = sysv_cache_reload();
+ pcap_reloaded = sysv_cache_reload(&pcache);
goto done;
}
#endif
#ifdef AIX
if (strstr_m(pcap_name, "/qconfig") != NULL) {
- pcap_reloaded = aix_cache_reload();
+ pcap_reloaded = aix_cache_reload(&pcache);
goto done;
}
#endif
- pcap_reloaded = std_pcap_cache_reload(pcap_name);
+ pcap_reloaded = std_pcap_cache_reload(pcap_name, &pcache);
done:
DEBUG(3, ("reload status: %s\n", (pcap_reloaded) ? "ok" : "error"));
/* cleanup old entries only if the operation was successful,
* otherwise keep around the old entries until we can
* successfully reload */
- status = printer_list_clean_old();
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to cleanup printer list!\n"));
+
+ if (!pcap_cache_replace(pcache)) {
+ DEBUG(0, ("Failed to replace printer list!\n"));
}
+
if (post_cache_fill_fn != NULL) {
post_cache_fill_fn(ev, msg_ctx);
}
}
+ pcap_cache_destroy_specific(&pcache);
return;
}