diff options
author | gad <gad@FreeBSD.org> | 2000-11-05 02:24:20 +0000 |
---|---|---|
committer | gad <gad@FreeBSD.org> | 2000-11-05 02:24:20 +0000 |
commit | 1b125af7f8d5fe143e688682c0bb946a5e75e361 (patch) | |
tree | 882fdf9e15e301bc9011a8b615d28bdd05f62c3e /usr.sbin/lpr | |
parent | e58bfcf4db92e28f0077d66b927999d5a7577bda (diff) | |
download | FreeBSD-src-1b125af7f8d5fe143e688682c0bb946a5e75e361.zip FreeBSD-src-1b125af7f8d5fe143e688682c0bb946a5e75e361.tar.gz |
In the error-message routine for receiving a job, move the "cleanup" to be
after the error message is printed, because the error message may refer to
variables the "cleanup" routine will zero out.
PR: 21007
Diffstat (limited to 'usr.sbin/lpr')
-rw-r--r-- | usr.sbin/lpr/lpd/recvjob.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c index e9b0c4e..ebd0560 100644 --- a/usr.sbin/lpr/lpd/recvjob.c +++ b/usr.sbin/lpr/lpd/recvjob.c @@ -377,10 +377,25 @@ frecverr(msg, va_alist) #else va_start(ap); #endif - rcleanup(0); - syslog(LOG_ERR, "%s", fromb); + syslog(LOG_ERR, "Error receiving job from %s:", fromb); vsyslog(LOG_ERR, msg, ap); va_end(ap); + /* + * rcleanup is not called until AFTER logging the error message, + * because rcleanup will zap some variables which may have been + * supplied as parameters for that msg... + */ + rcleanup(0); + /* + * Add a minimal delay before returning the final error code to + * the sending host. This just in case that machine responds + * this error by INSTANTLY retrying (and instantly re-failing...). + * It would be stupid of the sending host to do that, but if there + * was a broken implementation which did it, the result might be + * obscure performance problems and a flood of syslog messages on + * the receiving host. + */ + sleep(2); /* a paranoid throttling measure */ putchar('\1'); /* return error code */ exit(1); } |