[dm-devel] [PATCH] multipathd: fix issue in 'map $map getprstatus' reply
Bart Van Assche
bart.vanassche at sandisk.com
Thu Oct 13 22:43:40 UTC 2016
On 10/12/2016 11:30 PM, peng.liang5 at zte.com.cn wrote:
> Thanks for your attention. I don't think it is necessary to do that.
> Whatever returning 1 or ENOMEM it will reply "fail\n" and set the
> returning to 1.
>
> The executed code in uxsock_trigger as follows.
> if (r > 0) {
> if (r == ETIMEDOUT)
> *reply = STRDUP("timeout\n");
> else
> *reply = STRDUP("fail\n");
> *len = strlen(*reply) + 1;
> r = 1;
> }
Hello Peng,
Anyone who wants to verify your patch has to look up the numeric value
of ETIMEDOUT to see whether or not the value of that constant is equal
to one. So using "return 1" makes the source code harder to read than
"return ENOMEM". Additionally, it is inconsistent from a stylistic point
of view that the caller compares the return value with an E... error
code and that the called function returns a numeric constant. So I would
appreciate it very much if you would change "return 1" into "return
ENOMEM" or any other symbolic E* error code of your preference.
Bart.
More information about the dm-devel
mailing list