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>

Brandon Williams committed Jan 9, 2017 at 10:50 UTC 0b9864aa28ba08d7fb901afee1a75a15e4ad431b
1 file changed +2
abspath.c
+2
@@ -141,6 +141,8 @@ char *strbuf_realpath(struct strbuf *resolved, const char *path,
141 strbuf_reset(&symlink);
142
143 if (num_symlinks++ > MAXSYMLINKS) {
144 + errno = ELOOP;
145 +
146 if (die_on_error)
147 die("More than %d nested symlinks "
148 "on path '%s'", MAXSYMLINKS, path);