diff options
author | David Disseldorp <ddiss@samba.org> | 2014-07-22 20:17:38 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-08-08 14:10:38 +0200 |
commit | e5e6e2c796f026ee6b04f99b327941d57b9bd026 (patch) | |
tree | 87fbf5e5ca105fec92f563ba54092a09e4eb7929 /source3/printing/print_aix.c | |
parent | 4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38 (diff) | |
download | samba-e5e6e2c796f026ee6b04f99b327941d57b9bd026.tar.gz samba-e5e6e2c796f026ee6b04f99b327941d57b9bd026.tar.xz samba-e5e6e2c796f026ee6b04f99b327941d57b9bd026.zip |
printing: reload printer_list.tdb from in memory list
This will allow in future for a single atomic printer_list.tdb update.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/printing/print_aix.c')
-rw-r--r-- | source3/printing/print_aix.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source3/printing/print_aix.c b/source3/printing/print_aix.c index 23d9a86fe3..927a71b294 100644 --- a/source3/printing/print_aix.c +++ b/source3/printing/print_aix.c @@ -29,12 +29,13 @@ #include "printing/pcap.h" #ifdef AIX -bool aix_cache_reload(void) +bool aix_cache_reload(struct pcap_cache **_pcache) { int iEtat; XFILE *pfile; char *line = NULL, *p; char *name = NULL; + struct pcap_cache *pcache = NULL; TALLOC_CTX *ctx = talloc_init("aix_cache_reload"); if (!ctx) { @@ -52,6 +53,8 @@ bool aix_cache_reload(void) iEtat = 0; /* scan qconfig file for searching <printername>: */ for (;(line = fgets_slash(NULL, 1024, pfile)); free(line)) { + bool ok; + if (*line == '*' || *line == 0) continue; @@ -67,6 +70,7 @@ bool aix_cache_reload(void) if (strcmp(p, "bsh") != 0) { name = talloc_strdup(ctx, p); if (!name) { + pcap_cache_destroy_specific(&pcache); SAFE_FREE(line); x_fclose(pfile); TALLOC_FREE(ctx); @@ -86,7 +90,10 @@ bool aix_cache_reload(void) /* name is found without stanza device */ /* probably a good printer ??? */ iEtat = 0; - if (!pcap_cache_add(name, NULL, NULL)) { + ok = pcap_cache_add_specific(&pcache, + name, NULL, NULL); + if (!ok) { + pcap_cache_destroy_specific(&pcache); SAFE_FREE(line); x_fclose(pfile); TALLOC_FREE(ctx); @@ -101,7 +108,10 @@ bool aix_cache_reload(void) } else if (strstr_m(line, "device")) { /* it's a good virtual printer */ iEtat = 0; - if (!pcap_cache_add(name, NULL, NULL)) { + ok = pcap_cache_add_specific(&pcache, + name, NULL, NULL); + if (!ok) { + pcap_cache_destroy_specific(&pcache); SAFE_FREE(line); x_fclose(pfile); TALLOC_FREE(ctx); @@ -113,6 +123,7 @@ bool aix_cache_reload(void) } } + *_pcache = pcache; x_fclose(pfile); TALLOC_FREE(ctx); return true; |