Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Aug 2002 15:25:05 -0700 (PDT)
From:      Nate Lawson <nate@root.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        brooks@one-eyed-alien.net, arch@FreeBSD.ORG
Subject:   Re: kernel strlcpy
Message-ID:  <Pine.BSF.4.21.0208161522100.43853-100000@root.org>
In-Reply-To: <20020816.141548.17599527.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 16 Aug 2002, M. Warner Losh wrote:
> : I am not advocating introducing strlcat because strncat is bairly used
> : (only 9 times in the whole kernel.)
> 
> I think it would be reasonable.
> 
> In fact, if we ELIMINATE strncat and strncpy in the kernel, then that
> would be enough to justify bringing them in.  Since this isn't a
> hosted environment, we can do that if we want.
> 
> Warner

One useful thing about strncpy is that it overwrites the remainder of its
length with zeroes, not just null-terminating the string with a single
zero.  This is useful for fixed-length fields that aren't interpreted as
null-terminated strings but can be a huge performance hit when all you
wanted was single null termination (i.e. path).

-Nate


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0208161522100.43853-100000>