Subject: Re: [PATCH 3/5] Make 'index_path()' use 'strbuf_readlink()'

From: Junio C Hamano <[email-masked]>
Date: Wed, 17 Dec 2008 12:37:38 -0800

Linus Torvalds <[email-masked]> writes:

> @@ -2537,20 +2536,17 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write
>  				     path);
>  		break;
>  	case S_IFLNK:
> -		len = xsize_t(st->st_size);
> -		target = xmalloc(len + 1);
> -		if (readlink(path, target, len + 1) != st->st_size) {
> +		if (strbuf_readlink(&sb, path, st->st_size)) {
>  			char *errstr = strerror(errno);
> -			free(target);
>  			return error("readlink(\"%s\"): %s", path,
>  			             errstr);

Thanks; as strbuf_readlink() does not do any iffy library calls that would
stomp on errno, the error reporting should still be valid here.