Stop pac dereferencing a null pointer if accounting is not enabeled.

PR:		24798 18191
Submitted by:	Nick Hilliard <nick@netability.ie>
Reviewed by:	gad
This commit is contained in:
David Malone 2001-02-25 13:50:29 +00:00
parent a69134f24c
commit 67ba68254b

View File

@ -450,7 +450,8 @@ chkprinter(s)
case PCAPERR_TCLOOP: case PCAPERR_TCLOOP:
fatal(pp, "%s", pcaperr(stat)); fatal(pp, "%s", pcaperr(stat));
} }
acctfile = pp->acct_file; if ((acctfile = pp->acct_file) == NULL)
errx(3, "accounting not enabled for printer %s", s);
if (!pflag && pp->price100) if (!pflag && pp->price100)
price = pp->price100/10000.0; price = pp->price100/10000.0;
sumfile = (char *) calloc(sizeof(char), strlen(acctfile)+5); sumfile = (char *) calloc(sizeof(char), strlen(acctfile)+5);