Subject: Re: error checking wrapper function proposal
To: None <>
From: Chapman Flack <>
List: tech-userlevel
Date: 06/19/2006 14:48:48
Elad Efrat wrote:
> Please express your concerns on the relevant thread on tech-userlevel@
> and not retroactively on source-changes@.
> -e.
>>>    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?