From 01acd4bb3833733f7487ad86ea6542239fe3c90b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 21 Nov 2007 13:56:36 -0800 Subject: Remove pstring from printing/*.c except for the tdb_unpack requirement (I'll be making that an allocating interface later). Jeremy. (This used to be commit d2ee75326ac291ab4f1860075ba35f58703c7d9d) --- source3/printing/print_aix.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'source3/printing/print_aix.c') 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 : */ - 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 -- cgit