[LTP] [PATCH v2] msync04.c: Use direct IO to verify the data is stored on disk

Cyril Hrubis chrubis@suse.cz
Fri Jun 14 17:28:43 CEST 2024


Hi!
> > +static void verify_mmaped(void)
> > +{
> > +	char *buffer = SAFE_MEMALIGN(getpagesize(), getpagesize());
> > +
> > +	tst_res(TINFO, "Haven't seen dirty bit so we check content of file instead");
> > +	test_fd = SAFE_OPEN("msync04/testfile", O_RDONLY | O_DIRECT);
> If this fails we have memory leak, because free() is not run.
> 
> > +	SAFE_READ(0, test_fd, buffer, getpagesize());
> Also here. Maybe create buf as static and have conditional free() also at the
> cleanup?

If these fail we exit the test, which frees memory anyways...

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list