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

Cyril Hrubis
2026-03-05T14:25:57Z

Hi!1
> > + 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';

I'm looking at safe_file_scanf() code and it calls tst_brkm_() in any
case that no conversion was done. So the buffer should be either be
filled with new data or the test should exit with an error. Do I miss
something?

--
Cyril Hrubis
chrubis@suse.cz