Subject: Re: CVS commit: src/sbin/ifconfig
To: Elad Efrat <elad@netbsd.org>
From: Chapman Flack <nblists@anastigmatix.net>
List: source-changes
Date: 06/19/2006 14:31:02
> fix incorrect usage of strncpy() to (an internal implementation of)
> estrlcpy().

>	void
>  	estrlcpy(char *dst, char *src, size_t len)
>  	{
>  	        if (strlcpy(dst, src, len) >= len) {
>  	                errno = ENAMETOOLONG;
>  	                err(1, "Cannot copy `%s'", src);
>  	        }
>  	}

This seems to be a bit of a pun on ENAMETOOLONG, which is defined
(by SUS and us) to be filename-specific, and to mean precisely that
a component of a pathname exceeded NAME_MAX(resp. MAXNAMELEN) or that
the entire path exceeded PATH_MAX(resp. MAXPATHLEN-1).

Obviously the function doesn't return, so it isn't a matter of
misleading the caller, but it will still print the message "File name
too long" which is a little odd and could send a user down the wrong
track trying to figure out why the utility might have failed. Would it
be bad to use errx and a specific message?

-Chap