summaryrefslogtreecommitdiff
path: root/source3/printing/print_svid.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1999-12-13 13:27:58 +0000
committerAndrew Tridgell <tridge@samba.org>1999-12-13 13:27:58 +0000
commit3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 (patch)
tree866dd15416c3d8554bb207709f433a87ad0c012d /source3/printing/print_svid.c
parentf6276724bafdb6145c0c7b565172d80cb04516ea (diff)
downloadsamba-3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7.tar.gz
samba-3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7.tar.bz2
samba-3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7.zip
first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
(This used to be commit 453a822a76780063dff23526c35408866d0c0154)
Diffstat (limited to 'source3/printing/print_svid.c')
-rw-r--r--source3/printing/print_svid.c17
1 files changed, 15 insertions, 2 deletions
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);