public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang via ltp <ltp@lists.linux.it>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls: newuname01: Convert to the new library.
Date: Fri, 6 Mar 2026 10:58:29 +0800	[thread overview]
Message-ID: <aapC1ZHA_XopT50y@redhat.com> (raw)
In-Reply-To: <aamSaHica1WmVDIT@yuki.lan>

On Thu, Mar 05, 2026 at 03:25:44PM +0100, Cyril Hrubis wrote:
> 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?

You're right, I somehow overlooked the SAFE_ macro, which will cause an
error if the read fails. Please ignore this comment.

-- 
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-03-06  2:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 16:14 [LTP] [PATCH] syscalls: newuname01: Convert to the new library Cyril Hrubis
2026-03-05  1:51 ` Li Wang via ltp
2026-03-05 14:25   ` Cyril Hrubis
2026-03-06  2:58     ` Li Wang via ltp [this message]
2026-03-12 13:26 ` Andrea Cervesato via ltp
2026-04-07 12:08   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aapC1ZHA_XopT50y@redhat.com \
    --to=ltp@lists.linux.it \
    --cc=chrubis@suse.cz \
    --cc=liwang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox