[LTP] [PATCH v2 1/7] Add more safe macros for mqueue API

Petr Vorel pvorel@suse.cz
Tue Jul 26 08:48:18 CEST 2022


Hi Andrea,

> Hi!

> On 6/16/22 23:57, Petr Vorel wrote:
> > Hi Andrea,

> > ...
> > > > +static inline int safe_mq_close(const char *file, const int lineno,
> > > > +				mqd_t __mqdes)
> > > > +{
> > > > +	int rval;
> > > > +
> > > > +	rval = mq_close(__mqdes);
> > > > +
> > > > +	if (rval == -1) {
> > > > +		tst_brk_(file, lineno, TBROK | TERRNO,
> > > > +			"mq_close(%d) failed", __mqdes);
> > > > +	}
> > > How about check for invalid return value?
> > > 	} else if (rval < 0) {
> > > 		tst_brk_(file, lineno, TBROK | TERRNO,
> > > 			"Invalid mq_close(%d) return value %d", __mqdes, rval);
> > > 	}
> > Also safe_mq_open() could have check for invalid return value.

> It's already like that, Isn't it?

No it's not. But looking for v3 of this patchset (v3) you have added it.
Thanks!

Kind regards,
Petr

> > Kind regards,
> > Petr

> Andrea



More information about the ltp mailing list