[LTP] [PATCH 1/1] tst_kvcmp: Fix parsing format for /etc/os-release
Petr Vorel
pvorel@suse.cz
Thu Aug 20 13:05:50 CEST 2020
Hi Cyril, Po-Hsu,
> > if (access(OSRELEASE_PATH, F_OK) != -1) {
> > - SAFE_FILE_LINES_SCANF(NULL, OSRELEASE_PATH, "ID=%s", distname);
> > + SAFE_FILE_LINES_SCANF(NULL, OSRELEASE_PATH, "ID=\"%[^\"]\"",
> > + distname);
> I guess like opensuse is the only one that uses double quotes there.
> Does this actually work on, for example debian, that has ID=debian in
> the /etc/os-release?
No, sorry for overlooking that.
> I guess that it may be actually easier to optionaly strip the double
> quotes after the scanf().
+1, I'll send v2.
Kind regards,
Petr
More information about the ltp
mailing list