From 3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:27:58 +0000 Subject: first pass at updating head branch to be to be the same as the SAMBA_2_0 branch (This used to be commit 453a822a76780063dff23526c35408866d0c0154) --- source3/printing/print_svid.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'source3/printing/print_svid.c') diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c index 5c5eebeb50..85eaf8f95d 100644 --- a/source3/printing/print_svid.c +++ b/source3/printing/print_svid.c @@ -60,7 +60,17 @@ static void populate_printers(void) if (((tmp = strchr(buf, ' ')) == NULL) || ((tmp = strchr(++tmp, ' ')) == NULL)) continue; - name = ++tmp; + + /* + * In case we're only at the "for ". + */ + + if(!strncmp("for ",++tmp,4)) + { + tmp=strchr(tmp, ' '); + tmp++; + } + name = tmp; /* truncate the ": ..." */ if ((tmp = strchr(name, ':')) != NULL) @@ -69,9 +79,12 @@ static void populate_printers(void) /* add it to the cache */ if ((ptmp = malloc(sizeof (*ptmp))) != NULL) { ZERO_STRUCTP(ptmp); - ptmp->name = strdup(name); + if((ptmp->name = strdup(name)) == NULL) + DEBUG(0,("populate_printers: malloc fail in strdup !\n")); ptmp->next = printers; printers = ptmp; + } else { + DEBUG(0,("populate_printers: malloc fail for ptmp\n")); } } pclose(fp); -- cgit