real_path: set errno when max number of symlinks is exceeded
Set errno to ELOOP when the maximum number of symlinks is exceeded, as would be done by other symlink-resolving functions. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7aeb81f1de
commit
0b9864aa28
@ -141,6 +141,8 @@ char *strbuf_realpath(struct strbuf *resolved, const char *path,
|
|||||||
strbuf_reset(&symlink);
|
strbuf_reset(&symlink);
|
||||||
|
|
||||||
if (num_symlinks++ > MAXSYMLINKS) {
|
if (num_symlinks++ > MAXSYMLINKS) {
|
||||||
|
errno = ELOOP;
|
||||||
|
|
||||||
if (die_on_error)
|
if (die_on_error)
|
||||||
die("More than %d nested symlinks "
|
die("More than %d nested symlinks "
|
||||||
"on path '%s'", MAXSYMLINKS, path);
|
"on path '%s'", MAXSYMLINKS, path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user