summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/log.c
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2003-06-03 12:51:40 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2003-06-03 12:51:40 +0000
commit5f6a2902bcfd03976baf4360e5a1ea749a4d0700 (patch)
tree24420aafdef612d32c1c8988146120967c29f6ce /sbin/isakmpd/log.c
parent1fb7088aa35b34099638abe7575434151652e4e5 (diff)
Cleanup. Use 'sizeof variable' instead of magic constants.
Diffstat (limited to 'sbin/isakmpd/log.c')
-rw-r--r--sbin/isakmpd/log.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sbin/isakmpd/log.c b/sbin/isakmpd/log.c
index 3707abeb0fc..01ddf5c6b63 100644
--- a/sbin/isakmpd/log.c
+++ b/sbin/isakmpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.32 2003/05/18 19:37:46 ho Exp $ */
+/* $OpenBSD: log.c,v 1.33 2003/06/03 12:51:39 ho Exp $ */
/* $EOM: log.c,v 1.30 2000/09/29 08:19:23 niklas Exp $ */
/*
@@ -150,27 +150,27 @@ _log_print (int error, int syslog_level, const char *fmt, va_list ap,
struct timeval now;
time_t t;
- len = vsnprintf (buffer, LOG_SIZE, fmt, ap);
- if (len > 0 && len < LOG_SIZE - 1 && error)
- snprintf (buffer + len, LOG_SIZE - len, ": %s", strerror (errno));
+ len = vsnprintf (buffer, sizeof buffer, fmt, ap);
+ if (len > 0 && len < sizeof buffer - 1 && error)
+ snprintf (buffer + len, sizeof buffer - len, ": %s", strerror (errno));
if (log_output)
{
gettimeofday (&now, 0);
t = now.tv_sec;
tm = localtime (&t);
if (class >= 0)
- snprintf (nbuf, LOG_SIZE + 32, "%02d%02d%02d.%06ld %s %02d ",
+ snprintf (nbuf, sizeof nbuf, "%02d%02d%02d.%06ld %s %02d ",
tm->tm_hour, tm->tm_min, tm->tm_sec, now.tv_usec,
_log_get_class (class), level);
else /* LOG_PRINT (-1) or LOG_REPORT (-2) */
- snprintf (nbuf, LOG_SIZE + 32, "%02d%02d%02d.%06ld %s ", tm->tm_hour,
+ snprintf (nbuf, sizeof nbuf, "%02d%02d%02d.%06ld %s ", tm->tm_hour,
tm->tm_min, tm->tm_sec, now.tv_usec,
class == LOG_PRINT ? "Default" : "Report>");
- strlcat (nbuf, buffer, LOG_SIZE + 32);
+ strlcat (nbuf, buffer, sizeof nbuf);
#if defined (USE_PRIVSEP)
strlcat (nbuf, getuid() ? "" : " [priv]", LOG_SIZE + 32);
#endif
- strlcat (nbuf, "\n", LOG_SIZE + 32);
+ strlcat (nbuf, "\n", sizeof nbuf);
if (fwrite (nbuf, strlen (nbuf), 1, log_output) == 0)
{
@@ -232,7 +232,7 @@ log_debug_buf (int cls, int level, const char *header, const u_int8_t *buf,
log_debug (cls, level, "%s:", header);
for (i = j = 0; i < sz;)
{
- snprintf (s + j, 73 - j, "%02x", buf[i++]);
+ snprintf (s + j, sizeof s - j, "%02x", buf[i++]);
j += 2;
if (i % 4 == 0)
{