[LTP] [PATCH] syscalls: newuname01: Convert to the new library.

Li Wang liwang@redhat.com
Thu Mar 5 02:51:45 CET 2026


> + * Verify that uname() succeeds and correctly identifies the system as Linux.
> + * The rest of the values, when possible, are matched againts the strings from
                                                           ^ against

> -int main(int ac, char **av)
> -{
> -	struct utsname name;
> -	int lc;
> +	SAFE_FILE_SCANF("/proc/sys/kernel/hostname", "%1023[^\n]", proc_val);
> +	TST_EXP_EQ_STR(name->nodename, proc_val);
>  
> -	tst_parse_opts(ac, av, NULL, NULL);
> +	SAFE_FILE_SCANF("/proc/sys/kernel/osrelease", "%1023[^\n]", proc_val);
> +	TST_EXP_EQ_STR(name->release, proc_val);
>  
> -	setup();
> +	SAFE_FILE_SCANF("/proc/sys/kernel/version", "%1023[^\n]", proc_val);
> +	TST_EXP_EQ_STR(name->version, proc_val);

We'd better clear proc_val between reads:

  proc_val[0] = '\0';


Otherwise looks good:

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang



More information about the ltp mailing list