Reduce compiler warning: variable might be used uninitialized, by giving

an initial value.
This commit is contained in:
Philippe Charnier 2005-05-29 16:04:46 +00:00
parent ce2657c007
commit 865059c8a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146756

View File

@ -37,11 +37,12 @@ static const char copyright[] =
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
#ifndef lint
static char sccsid[] = "@(#)logger.c 8.1 (Berkeley) 6/6/93";
#endif
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@ -190,7 +191,7 @@ logmessage(int pri, char *host, char *buf)
hints.ai_socktype = SOCK_DGRAM;
error = getaddrinfo(host, "syslog", &hints, &res);
if (error == EAI_SERVICE) {
warnx ("syslog/udp: unknown service"); /* not fatal */
warnx("syslog/udp: unknown service"); /* not fatal */
error = getaddrinfo(host, "514", &hints, &res);
}
if (error)
@ -217,6 +218,7 @@ logmessage(int pri, char *host, char *buf)
if ((len = asprintf(&line, "<%d>%s", pri, buf)) == -1)
errx(1, "asprintf");
lsent = -1;
for (i = 0; i < nsock; ++i) {
lsent = sendto(socks[i].sock, line, len, 0,
(struct sockaddr *)&socks[i].addr,