[prev in list] [next in list] [prev in thread] [next in thread]
List: netbsd-tech-userlevel
Subject: Re: error checking wrapper function proposal
From: Chapman Flack <nblists () anastigmatix ! net>
Date: 2006-06-19 18:48:48
Message-ID: 4496F190.6080505 () anastigmatix ! net
[Download RAW message or body]
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?
>>
>>-Chap
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic