summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/lpr
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2001-06-15 22:03:07 +0000
committergad <gad@FreeBSD.org>2001-06-15 22:03:07 +0000
commite402d6c9159ae45f5056765c53cebfe6c25ee35e (patch)
tree34bd9934cba11944407fb52a6d7f9c516d667752 /usr.sbin/lpr/lpr
parent134649df9dfcfa24c39e28dcbf0b24db1b8f9605 (diff)
downloadFreeBSD-src-e402d6c9159ae45f5056765c53cebfe6c25ee35e.zip
FreeBSD-src-e402d6c9159ae45f5056765c53cebfe6c25ee35e.tar.gz
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
Diffstat (limited to 'usr.sbin/lpr/lpr')
-rw-r--r--usr.sbin/lpr/lpr/lpr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c
index a3b2e37..143d98a 100644
--- a/usr.sbin/lpr/lpr/lpr.c
+++ b/usr.sbin/lpr/lpr/lpr.c
@@ -80,7 +80,7 @@ static const char rcsid[] =
#include "pathnames.h"
static char *cfname; /* daemon control files, linked from tf's */
-static char *class = host; /* class title on header page */
+static char *class = local_host; /* class title on header page */
static char *dfname; /* data files */
static char *fonts[4]; /* troff font names */
static char format = 'f'; /* format char for printing files */
@@ -152,7 +152,7 @@ main(int argc, char *argv[])
signal(SIGTERM, cleanup);
progname = argv[0];
- gethostname(host, sizeof(host));
+ gethostname(local_host, sizeof(local_host));
openlog("lpd", 0, LOG_LPR);
errs = 0;
@@ -326,7 +326,7 @@ main(int argc, char *argv[])
(void) fchown(tfd, pp->daemon_user, -1);
/* owned by daemon for protection */
seteuid(uid);
- card('H', host);
+ card('H', local_host);
card('P', person);
card('C', class);
if (hdr && !pp->no_header) {
@@ -854,7 +854,7 @@ mktemps(const struct printer *pp)
n = n * 10 + (*cp++ - '0');
}
}
- len = strlen(pp->spool_dir) + strlen(host) + 8;
+ len = strlen(pp->spool_dir) + strlen(local_host) + 8;
tfname = lmktemp(pp, "tf", n, len);
cfname = lmktemp(pp, "cf", n, len);
dfname = lmktemp(pp, "df", n, len);
@@ -876,6 +876,7 @@ lmktemp(const struct printer *pp, const char *id, int num, int len)
if ((s = malloc(len)) == NULL)
errx(1, "out of memory");
- (void) snprintf(s, len, "%s/%sA%03d%s", pp->spool_dir, id, num, host);
+ (void) snprintf(s, len, "%s/%sA%03d%s", pp->spool_dir, id, num,
+ local_host);
return(s);
}
OpenPOWER on IntegriCloud