author | Linus Torvalds <torvalds@linux-foundation.org> | |
Wed, 17 Dec 2008 17:36:40 +0000 (09:36 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 17 Dec 2008 21:36:30 +0000 (13:36 -0800) | ||
commit | b11b7e13f48ee283738e21fea9f775cd40ca0562 | |
tree | f1c1a1a271f018865e1b95b5885cb71520da13a8 | tree | snapshot |
parent | 53682f0c9e7545c6fa891896a5de4ad441a76147 | commit | diff |
Add generic 'strbuf_readlink()' helper function
It was already what 'git apply' did in read_old_data(), just export it
as a real function, and make it be more generic.
In particular, this handles the case of the lstat() st_size data not
matching the readlink() return value properly (which apparently happens
at least on NTFS under Linux). But as a result of this you could also
use the new function without even knowing how big the link is going to
be, and it will allocate an appropriately sized buffer.
So we pass in the st_size of the link as just a hint, rather than a
fixed requirement.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It was already what 'git apply' did in read_old_data(), just export it
as a real function, and make it be more generic.
In particular, this handles the case of the lstat() st_size data not
matching the readlink() return value properly (which apparently happens
at least on NTFS under Linux). But as a result of this you could also
use the new function without even knowing how big the link is going to
be, and it will allocate an appropriately sized buffer.
So we pass in the st_size of the link as just a hint, rather than a
fixed requirement.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-apply.c | diff | blob | history | |
strbuf.c | diff | blob | history | |
strbuf.h | diff | blob | history |