Date: Mon, 24 Apr 2000 18:19:51 +0800 (CST) From: Kuang-che Wu <kcwu@camel.ck.tp.edu.tw> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/18191: pac core dumped Message-ID: <200004241019.SAA07197@camel.ck.tp.edu.tw>
next in thread | raw e-mail | index | archive | help
>Number: 18191
>Category: bin
>Synopsis: pac core dumped without set /etc/printcap
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Apr 24 03:30:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Kuang-che Wu
>Release: FreeBSD 4.0-STABLE i386
>Organization:
Chien-kuo Senior High School
>Environment:
FreeBSD camel.ck.tp.edu.tw 4.0-STABLE FreeBSD 4.0-STABLE #0: Sat Apr 22 08:20:49
CST 2000 root@camel.ck.tp.edu.tw:/usr/local/bsdsrc/sys/compile/camel i386
>Description:
If "af=" field not set in /etc/printcap,
run /usr/sbin/pac will get core dumped
NOTE: this problem exists in every version of FreeBSD
>How-To-Repeat:
# pac
Segmentation fault (core dumped)
>Fix:
--- /usr/src/usr.sbin/lpr/pac/pac.c.orig Mon Apr 24 18:02:20 2000
+++ /usr/src/usr.sbin/lpr/pac/pac.c Mon Apr 24 18:09:39 2000
@@ -180,6 +180,11 @@
exit(2);
}
+ if (acctfile == NULL) {
+ printf("pac: acct.file of printer %s didn't set in printcap\n",
+ printer);
+ exit(1);
+ }
if ((acct = fopen(acctfile, "r")) == NULL) {
perror(acctfile);
exit(1);
@@ -453,10 +458,12 @@
acctfile = pp->acct_file;
if (!pflag && pp->price100)
price = pp->price100/10000.0;
- sumfile = (char *) calloc(sizeof(char), strlen(acctfile)+5);
- if (sumfile == NULL)
- errx(1, "calloc failed");
- strcpy(sumfile, acctfile);
- strcat(sumfile, "_sum");
+ if (acctfile) {
+ sumfile = (char *) calloc(sizeof(char), strlen(acctfile)+5);
+ if (sumfile == NULL)
+ errx(1, "calloc failed");
+ strcpy(sumfile, acctfile);
+ strcat(sumfile, "_sum");
+ }
return(1);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004241019.SAA07197>
