[LTP] [PATCH v2 1/7] Add more safe macros for mqueue API
Petr Vorel
pvorel@suse.cz
Thu Jun 16 23:57:37 CEST 2022
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.
Kind regards,
Petr
More information about the ltp
mailing list