nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] strncpy(3), die, die, die.

2016-10-29 18:21:28


Ralph Corderoy wrote:
They don't need to be checked because they're only used in those cases
where truncation, but still NUL-terminated, is valid.  Kind of like when
`%.42s' is used in a lexer error message in case the token is runaway,
or 'cut -c 42'.  Ken's saying that some of them are like that, e.g.
feeding back unknown errors from outside.  And the function's comment
would make their intended use case very clear.

ah, ok. let's make it nec'y (via Makefile settings) to cast to void in
that situation, to avoid compiler warnings.

i use asprintf() for this kind of thing.

It's nice, but it might do the formatting work twice, and the return
value needs checking, not just for "out of memory" errors, the char** is
not guaranteed to be NULL on error with GNU, and that checking conflicts
with the "minimal call-site change" that's my aim.

got it.

-- 
P Vixie


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>