From e402d6c9159ae45f5056765c53cebfe6c25ee35e Mon Sep 17 00:00:00 2001 From: gad Date: Fri, 15 Jun 2001 22:03:07 +0000 Subject: Rename a few global variables which hold hostname-related values to be more sensible/understandable. 'from'->'from_host' 'host'->'local_host' 'fromb'->'frombuf' 'fromhost'->'origin_host' and a local-variable named 'host'->'hostbuf'. This fixes some compile-time warnings about local variables shadowing global variables. Other than renaming variables, the only actual code changes are to call strlcpy() instead of strncpy() when setting those (renamed) variables, and that 'from_ip' is now a strdup()-created buffer instead of being a static buffer compiled in as 1025 bytes. Reviewed by: freebsd-print@bostonradio.org (an earlier version) MFC after: 1 week --- usr.sbin/lpr/lpd/recvjob.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr.sbin/lpr/lpd/recvjob.c') diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c index 661ad05..99e38de 100644 --- a/usr.sbin/lpr/lpd/recvjob.c +++ b/usr.sbin/lpr/lpd/recvjob.c @@ -186,7 +186,8 @@ readjob(struct printer *pp) * something different than what gethostbyaddr() * returns */ - strncpy(cp + 6, from, sizeof(line) + line - cp - 7); + strncpy(cp + 6, from_host, sizeof(line) + line - cp + - 7); line[sizeof(line) - 1 ] = '\0'; strncpy(tfname, cp, sizeof(tfname) - 1); tfname[sizeof (tfname) - 1] = '\0'; @@ -231,7 +232,7 @@ readjob(struct printer *pp) dfcnt++; trstat_init(pp, dfname, dfcnt); (void) readfile(pp, dfname, size); - trstat_write(pp, TR_RECVING, size, givenid, from, + trstat_write(pp, TR_RECVING, size, givenid, from_host, givenhost); continue; } @@ -386,7 +387,7 @@ frecverr(msg, va_alist) #else va_start(ap); #endif - syslog(LOG_ERR, "Error receiving job from %s:", fromb); + syslog(LOG_ERR, "Error receiving job from %s:", from_host); vsyslog(LOG_ERR, msg, ap); va_end(ap); /* -- cgit v1.1