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

Li Wang via ltp
2026-03-05T01:52:19Z

> + * 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