[dpdk-dev] [PATCH 21.08] power: refactor pstate sysfs handling

Stephen Hemminger stephen at networkplumber.org
Fri Apr 2 19:46:42 CEST 2021


On Thu,  1 Apr 2021 15:05:17 +0000
Anatoly Burakov <anatoly.burakov at intel.com> wrote:

> +	/* fgets puts null terminator in, but do this just in case */
> +	buf[BUFSIZ - 1] = '\0';
> +
> +	/* strip off any terminating newlines */
> +	if (strlen(buf))
> +		strtok(buf, "\n");

Why not the simpler/shorter
	strchrnul(buf, '\n') = '\0';


More information about the dev mailing list