Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Sep 2000 00:14:58 -0400 (EDT)
From:      Garance A Drosehn <gad@freefour.acs.rpi.edu>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        gad@eclipse.acs.rpi.edu
Subject:   bin/21007: Improve/fix error messages in lpr's recvjob processing
Message-ID:  <200009030414.AAA73848@freefour.acs.rpi.edu>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009030414.AAA73848>