[LTP] [PATCH v1] libswap.c: Improve caculate swap dev number

Li Wang liwang@redhat.com
Mon Mar 4 09:49:35 CET 2024


On Sun, Mar 3, 2024 at 9:14 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Wei, Xu,
>
> > Hi  Wei
>
> > > I encounter a dead loop on following code in our test on ppc64 machine:
> > > while ((c = fgetc(fp)) != EOF)
>
> > > I think "/proc/swaps" is not normal file and can not get EOF in some
> situation,
> > > so i use fgets a line and caculate swap dev number.
>
> I guess the problem has been fixed by another patch [1], thus closing it in
> patchwork. Please let me know if not.
>

Seems not, the patch [1] below is mainly to count the free disk size.

But Wei's work here is to calculate swap-dev numbers correctly
(especially get rid of EOF affection to some degree).

Xu Yang, what do you think? or did I miss anything here?



-- 
Regards,
Li Wang


More information about the ltp mailing list