From owner-freebsd-bugs Mon Apr 24 3:30: 5 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 0A07B37B9D7 for ; Mon, 24 Apr 2000 03:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id DAA20420; Mon, 24 Apr 2000 03:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from camel.ck.tp.edu.tw (camel.ck.tp.edu.tw [203.64.26.1]) by hub.freebsd.org (Postfix) with ESMTP id 1412737BA82 for ; Mon, 24 Apr 2000 03:20:13 -0700 (PDT) (envelope-from kcwu@camel.ck.tp.edu.tw) Received: (from kcwu@localhost) by camel.ck.tp.edu.tw (8.9.3/8.9.3) id SAA07197; Mon, 24 Apr 2000 18:19:51 +0800 (CST) (envelope-from kcwu) Message-Id: <200004241019.SAA07197@camel.ck.tp.edu.tw> Date: Mon, 24 Apr 2000 18:19:51 +0800 (CST) From: Kuang-che Wu Reply-To: kcwu@camel.ck.tp.edu.tw To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/18191: pac core dumped Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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