[LTP] [PATCH] lib/tst_tmpdir: tst_get_tmpdir() add error handing

Cyril Hrubis chrubis@suse.cz
Mon Aug 9 15:24:22 CEST 2021


Hi!
> > -	return strdup(TESTDIR);
> > +	ret = strdup(TESTDIR);
> Is a failing strdup here really a thing? The only reason strdup should 
> be able to fail is with ENOMEM.
> The only way tst_brkm will work, if strdup fails here is, if TESTDIR is 
> an extremely huge string (the NULL case is already handled above).

It's unlikely, but it may happen if:

* Someone runs memeater on the baground along with LTP
* And kernel is set not to overcommit

And in a case of the test lirary I would rather see it written so that
we check everything, even the unlikely errors.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list