Skip to content

Commit

Permalink
fix a few issues, and order of params
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Mar 9, 2025
1 parent cbe9a30 commit 05698a2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions usr.sbin/lpr/pac/pac.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ dumpit(void)

hp = hashtab[0];
hno = 1;
base = (struct hent **) calloc(sizeof hp, hcount);
base = (struct hent **) calloc(hcount, sizeof(hp));
for (ap = base, c = hcount; c--; ap++) {
while (hp == NULL)
hp = hashtab[hno++];
Expand Down Expand Up @@ -338,9 +338,8 @@ enter(const char name[])
return(hp);
h = hash(name);
hcount++;
hp = (struct hent *) calloc(sizeof *hp, (size_t)1);
hp->h_name = (char *) calloc(sizeof(char), strlen(name)+1);
strcpy(hp->h_name, name);
hp = (struct hent *) calloc(1, sizeof(*hp));
hp->h_name = strdup(name);
hp->h_feetpages = 0.0;
hp->h_count = 0;
hp->h_link = hashtab[h];
Expand Down Expand Up @@ -441,10 +440,8 @@ chkprinter(const char *ptrname)
errx(3, "accounting not enabled for printer %s", ptrname);
if (!pflag && pp->price100)
price = pp->price100/10000.0;
sumfile = (char *) calloc(sizeof(char), strlen(acctfile)+5);
asprintf(&sumfile, "%s_sum", acctfile);
if (sumfile == NULL)
errx(1, "calloc failed");
strcpy(sumfile, acctfile);
strcat(sumfile, "_sum");
errx(1, "asprintf failed");
return(1);
}

0 comments on commit 05698a2

Please sign in to comment.