[LTP] [PATCH 1/3 v2] tst_supported_fs: Unify messaging

Petr Vorel pvorel@suse.cz
Fri Sep 23 18:31:26 CEST 2022


> Hi!
> > +#define err(...) ({ \
> > +	fprintf(stderr, __VA_ARGS__); \
> > +	fprintf(stderr, "\n"); \
> > +	usage(); \
> > +	return 2; })
>            ^
> This should rather be exit(2);

Thanks! I thought that just after sending that.

> It's only matter of time until someone uses that in a function outside
> of main.

> > +#define fail(...) ({ \
> > +	fprintf(stderr, __VA_ARGS__); \
> > +	fprintf(stderr, "\n"); \
> > +	return 1; })

> Here as well.

> > +#define info(...) ({ \
> > +	fprintf(stderr, __VA_ARGS__); \
> > +	fprintf(stderr, "\n"); \
> > +	return 0; })

> The naming here is a bit of strange, I wouldn't expect that function
> called info() would exit the process.

> Maybe these three should include exit in the function name such as
> info_exit(), err_exit() and fail_exit().
+1

I'll fix it in another version or fix it before merge (if all changes are
trivial).

Kind regards,
Petr


More information about the ltp mailing list