public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/1] tst_kvcmp: Strip double quotes when parsing /etc/os-release
Date: Thu, 20 Aug 2020 14:53:12 +0200	[thread overview]
Message-ID: <20200820125312.GD9000@yuki.lan> (raw)
In-Reply-To: <20200820124959.GB5065@dell5510>

Hi!
> > > diff --git a/lib/tst_kvercmp.c b/lib/tst_kvercmp.c
> > > index 185a5c39c..dfd81ac83 100644
> > > --- a/lib/tst_kvercmp.c
> > > +++ b/lib/tst_kvercmp.c
> > > @@ -148,6 +148,12 @@ const char *tst_kvcmp_distname(const char *kver)
> > >  	if (access(OSRELEASE_PATH, F_OK) != -1) {
> > >  		SAFE_FILE_LINES_SCANF(NULL, OSRELEASE_PATH, "ID=%s", distname);
> 
> > > +		if (p[0] == '"')
> > > +			memmove(p, p + 1, strlen(p));
> 
> > Why can't we just do distname++ and move the p = distname after this
> > condition?
> OK, distname is char[], not a pointer, I guess I have to use memmove().

In that case you just need to do char *ret = distname + 1; p = ret; ....
return ret;

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2020-08-20 12:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 12:00 [LTP] [PATCH v2 1/1] tst_kvcmp: Strip double quotes when parsing /etc/os-release Petr Vorel
2020-08-20 12:25 ` Cyril Hrubis
2020-08-20 12:43   ` Petr Vorel
2020-08-20 12:49   ` Petr Vorel
2020-08-20 12:53     ` Cyril Hrubis [this message]

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=20200820125312.GD9000@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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