Re: [PATCH v3 05/10] abspath: convert real_path_internal() to strbuf

2014-07-29 Thread Junio C Hamano
René Scharfe writes: >> "Next call to the function invalidates the return value the last >> caller received" feels like playing with fire. Most existing >> callers are safe in that the first thing they do to the returned >> string is xstrdup() it, but we would need to check all the other >> call

Re: [PATCH v3 05/10] abspath: convert real_path_internal() to strbuf

2014-07-28 Thread René Scharfe
Am 28.07.2014 um 23:42 schrieb Junio C Hamano: Jeff King writes: On Mon, Jul 28, 2014 at 08:28:30PM +0200, René Scharfe wrote: @@ -60,26 +58,22 @@ static const char *real_path_internal(const char *path, int die_on_error) goto error_out; } - if (strlcpy

Re: [PATCH v3 05/10] abspath: convert real_path_internal() to strbuf

2014-07-28 Thread René Scharfe
Am 28.07.2014 um 21:09 schrieb Jeff King: On Mon, Jul 28, 2014 at 08:28:30PM +0200, René Scharfe wrote: static const char *real_path_internal(const char *path, int die_on_error) { - static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1]; + static struct strbuf sb

Re: [PATCH v3 05/10] abspath: convert real_path_internal() to strbuf

2014-07-28 Thread Junio C Hamano
Jeff King writes: > On Mon, Jul 28, 2014 at 08:28:30PM +0200, René Scharfe wrote: > >> @@ -60,26 +58,22 @@ static const char *real_path_internal(const char *path, >> int die_on_error) >> goto error_out; >> } >> >> -if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) { >

Re: [PATCH v3 05/10] abspath: convert real_path_internal() to strbuf

2014-07-28 Thread Jeff King
On Mon, Jul 28, 2014 at 08:28:30PM +0200, René Scharfe wrote: > @@ -60,26 +58,22 @@ static const char *real_path_internal(const char *path, > int die_on_error) > goto error_out; > } > > - if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) { > - if (die_on_

Re: [PATCH v3 05/10] abspath: convert real_path_internal() to strbuf

2014-07-28 Thread Jeff King
On Mon, Jul 28, 2014 at 08:28:30PM +0200, René Scharfe wrote: > static const char *real_path_internal(const char *path, int die_on_error) > { > - static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1]; > + static struct strbuf sb = STRBUF_INIT; Hrm. I thought at first th