[LTP] [PATCH v2 2/7] Refactor mqns_01 using new LTP API

Petr Vorel pvorel@suse.cz
Thu Jun 16 23:56:45 CEST 2022


Hi Andrea,

> +static inline int get_clone_unshare_enum(const char* str_op)
> +{
> +	if (!str_op || !strcmp(str_op, "none"))
nit: If "none" is a default, how about drop '-m none' entirely? (use without -m)?

> +		return T_NONE;
> +	else if (!strcmp(str_op, "clone"))
> +		return T_CLONE;
> +	else if (!strcmp(str_op, "unshare"))
> +		return T_UNSHARE;
> +
> +	return T_NONE;
> +}

...

> +	mqd = SAFE_MQ_OPEN(MQNAME, O_RDWR | O_CREAT | O_EXCL, 0777, NULL);
> +	if (mqd == -1)
> +		tst_brk(TBROK | TERRNO, "mq_open failed");
This if check is not needed (done by SAFE_MQ_OPEN()
> +}

Kind regards,
Petr


More information about the ltp mailing list