From owner-freebsd-bugs Sat Sep 2 21:20: 7 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1E2D437B424 for ; Sat, 2 Sep 2000 21:20:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id VAA21534; Sat, 2 Sep 2000 21:20:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefour.acs.rpi.edu (freefour.acs.rpi.edu [128.113.24.91]) by hub.freebsd.org (Postfix) with ESMTP id 2E61A37B424 for ; Sat, 2 Sep 2000 21:14:59 -0700 (PDT) Received: (from gad@localhost) by freefour.acs.rpi.edu (8.9.3/8.9.3) id AAA73848; Sun, 3 Sep 2000 00:14:58 -0400 (EDT) (envelope-from gad) Message-Id: <200009030414.AAA73848@freefour.acs.rpi.edu> Date: Sun, 3 Sep 2000 00:14:58 -0400 (EDT) From: Garance A Drosehn Reply-To: gad@eclipse.acs.rpi.edu To: FreeBSD-gnats-submit@freebsd.org Cc: gad@eclipse.acs.rpi.edu X-Send-Pr-Version: 3.2 Subject: bin/21007: Improve/fix error messages in lpr's recvjob processing Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 21007 >Category: bin >Synopsis: Improve/fix error messages in lpr's recvjob processing >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: Sat Sep 02 21:20:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Garance A Drosehn >Release: FreeBSD 4.-stable and 5.-current i386 >Organization: RPI ; Troy, NY >Environment: Just running lpr... More precisely, running lpd on a print-server machine, which is accepting jobs from other hosts. >Description: When lpd is receiving jobs, there are several error checks where it calls an 'frecverr' routine. That FIRST calls a cleanup routine, and THEN sends a given message to syslog. The problem is that the cleanup routine may zero out some of the fields included in the error message, thus making the error message less useful. Also, frecverr sends two syslog messages. the first one is nothing but a hostname, which seems meaningless if you're looking at syslog error messages and you are not aware of what lpd is doing. I thought it could stand to be a bit more meaningful. >How-To-Repeat: Use lpd on a printserver. Send jobs. Get errors. Look at syslog. >Fix: Here's an update: --- recvjob.c.orig Fri Aug 27 21:16:53 1999 +++ recvjob.c Sat Sep 2 23:39:25 2000 @@ -367,10 +367,14 @@ #else va_start(ap); #endif - rcleanup(0); - syslog(LOG_ERR, "%s", fromb); + syslog(LOG_ERR, "while receiving job from %s:", fromb); vsyslog(LOG_ERR, msg, ap); va_end(ap); + /* don't call rcleanup until AFTER logging the error message, + * because rcleanup will zap some variables which may have been + * given as parameters in that msg... */ + rcleanup(0); + sleep(2); putchar('\1'); /* return error code */ exit(1); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message