[LTP] [PATCH] Add terminating NUL after calling readlink()

Petr Vorel pvorel@suse.cz
Tue May 9 07:45:33 CEST 2017


Hi,

> readlink() does not append a NUL byte to the target buffer. Fix it in
> the pidns03 and fsstress testcases to avoid wrong test results.

<snip>
>  	rval = readlink(name->path, lbuf, lbufsiz);
> +	if (rval >= 0)
> +		lbuf[rval] = 0; /* add terminating NUL */
How about using '\0' and leave the comment?


Kind regards,
Petr


More information about the ltp mailing list