Re: [PATCH] zero-terminate result of target_read_alloc

Daniel Jacobowitz
2006-07-26T22:25:52Z

On Wed, Jul 26, 2006 at 11:51:24PM +0200, Mark Kettenis wrote:
> > Date: Mon, 24 Jul 2006 18:00:43 -0400
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > All right! Compromise and progress! Thanks, Mark.
> >
> > How about this patch (untested so far)? My only concern is that it
> > doesn't report error/unsupported separately from empty; but for all the
> > uses I know of so far, that's not a problem, and we can change it later
> > if we need to.
>
> Better get this right from the start, and return xstrdup("") for
> "empty". Also the error message

... Why didn't I think of that? Brilliant!

> "... contained unexpected zero bytes"
>
> is not very clear; the first time I thought that would warn about
> returning an empty string. How about changing that to
>
> "... contained unexpected null characters"
>
> ?
>
> The C standard uses the term "null character" for a byte with all bits
> set to 0.

That works for me. OK with those changes?

--
Daniel Jacobowitz
CodeSourcery