From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCHv2 1/2] lib/tst_kvercmp: Add support to get distname for different OS in tst_kvcmp_distname
Date: Tue, 18 Aug 2020 17:29:41 +0200 [thread overview]
Message-ID: <20200818152941.GG27964@yuki.lan> (raw)
In-Reply-To: <20200818100422.27775-2-po-hsu.lin@canonical.com>
Hi!
> static char *parse_digit(const char *str, int *d)
> {
> unsigned long v;
> @@ -127,6 +130,8 @@ int tst_kvexcmp(const char *tst_exv, const char *cur_ver)
>
> const char *tst_kvcmp_distname(const char *kver)
> {
> + static char distname[64];
> + char *tok;
> if (strstr(kver, ".el5uek"))
> return "OL5UEK";
>
> @@ -139,6 +144,17 @@ const char *tst_kvcmp_distname(const char *kver)
> if (strstr(kver, ".el6"))
> return "RHEL6";
>
> + // Special case for other releases with the presencse of /etc/os-release
> + if (access(OSRELEASE_PATH, F_OK) != -1) {
> + SAFE_FILE_LINES_SCANF(NULL, OSRELEASE_PATH, "ID=%s", distname);
> + tok = strtok(distname,"\0");
Isn't this strtok() useless?
Other than that the patchset looks fine.
> + while (*tok) {
> + *tok = toupper((unsigned char) *tok);
> + tok++;
> + }
> + return distname;
> + }
> +
> return NULL;
> }
>
> --
> 2.25.1
>
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2020-08-18 15:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 10:04 [LTP] [PATCHv2 0/2] Fix for syscalls/utimensat01 test on Ubuntu 4.4 kernel Po-Hsu Lin
2020-08-18 10:04 ` [LTP] [PATCHv2 1/2] lib/tst_kvercmp: Add support to get distname for different OS in tst_kvcmp_distname Po-Hsu Lin
2020-08-18 15:29 ` Cyril Hrubis [this message]
2020-08-18 16:20 ` Po-Hsu Lin
2020-08-18 18:30 ` Cyril Hrubis
2020-08-19 1:34 ` Po-Hsu Lin
2020-08-19 8:56 ` Cyril Hrubis
2020-08-18 10:04 ` [LTP] [PATCHv2 2/2] syscalls/utimensat01: add exception for Ubuntu 4.4 kernel Po-Hsu Lin
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=20200818152941.GG27964@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