diff options
author | Andrew Tridgell <tridge@samba.org> | 1999-12-13 13:27:58 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1999-12-13 13:27:58 +0000 |
commit | 453a822a76780063dff23526c35408866d0c0154 (patch) | |
tree | 804feffcd5e60153e27d3ca2b007021e66e5bd0a /source/printing/print_svid.c | |
parent | 054195df9b6187c663ede5cf4489499abbdc29fc (diff) | |
download | samba-453a822a76780063dff23526c35408866d0c0154.tar.gz |
first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
Diffstat (limited to 'source/printing/print_svid.c')
-rw-r--r-- | source/printing/print_svid.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/printing/print_svid.c b/source/printing/print_svid.c index 5c5eebeb502..85eaf8f95dd 100644 --- a/source/printing/print_svid.c +++ b/source/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); |