[PATCH] selftests/powerpc: Fix strncpy usage

Paul Clarke pc at us.ibm.com
Sat Jun 23 01:15:29 AEST 2018


On 06/22/2018 09:43 AM, Breno Leitao wrote:
> If you don't mind, I would solve this problem slightly different, as it seems
> to be more readable.
> 
> -       strncpy(prog, argv[0], strlen(argv[0]));
> +       if (strlen(argv[0]) >= LEN_MAX){
> +               fprintf(stderr, "Very big executable name: %s\n", argv[0]);

"Very big" is an observation.  "Too big" indicates a problem better.  Or, more explicitly "Executable name is too long".

PC



More information about the Linuxppc-dev mailing list