diff options
author | James Peach <jpeach@samba.org> | 2007-11-21 18:31:35 -0800 |
---|---|---|
committer | James Peach <jpeach@samba.org> | 2007-11-21 18:31:35 -0800 |
commit | 64b54e534008a1ac36b9ba21726ca0954fe00d63 (patch) | |
tree | 5a5e0f42c70d4afa14ba689bf4f97af321432510 /source3/printing/print_aix.c | |
parent | febaaae2021c2993d265cc48cf9fbef05cb4ed1b (diff) | |
parent | 7ef6c19074495110d5c0b698b05c4ee52a0744d6 (diff) | |
download | samba-64b54e534008a1ac36b9ba21726ca0954fe00d63.tar.gz samba-64b54e534008a1ac36b9ba21726ca0954fe00d63.tar.bz2 samba-64b54e534008a1ac36b9ba21726ca0954fe00d63.zip |
Merge ssh://git.samba.org/data/git/samba into v3-2-test
(This used to be commit 660ea443364e949ed06c28b00f0e1c3757f0da27)
Diffstat (limited to 'source3/printing/print_aix.c')
-rw-r--r-- | source3/printing/print_aix.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/source3/printing/print_aix.c b/source3/printing/print_aix.c index 15d0740fd2..bb125530df 100644 --- a/source3/printing/print_aix.c +++ b/source3/printing/print_aix.c @@ -32,21 +32,26 @@ bool aix_cache_reload(void) int iEtat; XFILE *pfile; char *line = NULL, *p; - pstring name, comment; + char *name; + TALLOC_CTX *ctx = talloc_init("aix_cache_reload"); + + if (!ctx) { + return false; + } *name = 0; - *comment = 0; DEBUG(5, ("reloading aix printcap cache\n")); if ((pfile = x_fopen(lp_printcapname(), O_RDONLY, 0)) == NULL) { DEBUG(0,( "Unable to open qconfig file %s for read!\n", lp_printcapname())); - return False; + TALLOC_FREE(ctx); + return false; } iEtat = 0; /* scan qconfig file for searching <printername>: */ - for (;(line = fgets_slash(NULL, sizeof(pstring), pfile)); safe_free(line)) { + for (;(line = fgets_slash(NULL, 1024, pfile)); safe_free(line)) { if (*line == '*' || *line == 0) continue; @@ -59,7 +64,13 @@ bool aix_cache_reload(void) *p = '\0'; p = strtok(line, ":"); if (strcmp(p, "bsh") != 0) { - pstrcpy(name, p); + name = talloc_strdup(ctx, p); + if (!name) { + safe_free(line); + x_fclose(pfile); + TALLOC_FREE(ctx); + return false; + } iEtat = 1; continue; } @@ -77,11 +88,12 @@ bool aix_cache_reload(void) if (!pcap_cache_add(name, NULL)) { safe_free(line); x_fclose(pfile); - return False; + TALLOC_FREE(ctx); + return false; } continue; } - + if (strstr_m(line, "backend")) { /* it's a device, not a virtual printer */ iEtat = 0; @@ -91,7 +103,8 @@ bool aix_cache_reload(void) if (!pcap_cache_add(name, NULL)) { safe_free(line); x_fclose(pfile); - return False; + TALLOC_FREE(ctx); + return false; } continue; } @@ -100,7 +113,8 @@ bool aix_cache_reload(void) } x_fclose(pfile); - return True; + TALLOC_FREE(ctx); + return true; } #else |