diff options
author | Cy Schubert <cy@FreeBSD.org> | 2014-12-20 22:52:39 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2014-12-20 22:52:39 +0000 |
commit | b5e14a1344528861a7016aa2c6b0f2e9630d1526 (patch) | |
tree | f04bed14f7e8aed5c0e9d2f7785175c7951036d3 /lib/isc/log.c | |
parent | 2b45e011ca352ce509bc83ae148230aeee0c7e0d (diff) |
Diffstat (limited to 'lib/isc/log.c')
-rw-r--r-- | lib/isc/log.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/isc/log.c b/lib/isc/log.c index e19c9ba98eaa..0c142ce7707a 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.94.332.5 2009/02/16 02:04:05 marka Exp $ */ +/* $Id$ */ /*! \file * \author Principal Authors: DCL */ @@ -41,6 +41,7 @@ #include <isc/string.h> #include <isc/time.h> #include <isc/util.h> +#include "ntp_stdlib.h" /* NTP change for strlcpy, strlcat */ #define LCTX_MAGIC ISC_MAGIC('L', 'c', 't', 'x') #define VALID_CONTEXT(lctx) ISC_MAGIC_VALID(lctx, LCTX_MAGIC) @@ -1342,9 +1343,10 @@ isc_log_open(isc_logchannel_t *channel) { (FILE_MAXSIZE(channel) > 0 && statbuf.st_size >= FILE_MAXSIZE(channel))) roll = regular_file; - } else if (errno == ENOENT) + } else if (errno == ENOENT) { regular_file = ISC_TRUE; - else + POST(regular_file); + } else result = ISC_R_INVALIDFILE; /* @@ -1408,6 +1410,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, int syslog_level; char time_string[64]; char level_string[24]; + size_t octets; const char *iformat; struct stat statbuf; isc_boolean_t matched = ISC_FALSE; @@ -1618,16 +1621,17 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, * It wasn't in the duplicate interval, * so add it to the message list. */ + octets = strlen(lctx->buffer) + 1; new = isc_mem_get(lctx->mctx, sizeof(isc_logmessage_t) + - strlen(lctx->buffer) + 1); + octets); if (new != NULL) { /* * Put the text immediately after * the struct. The strcpy is safe. */ new->text = (char *)(new + 1); - strcpy(new->text, lctx->buffer); + strlcpy(new->text, lctx->buffer, octets); TIME_NOW(&new->time); |