<font size=2 face="sans-serif">Hello Bart,</font>
<br>
<br><font size=2 face="sans-serif">I can understand your concern. It may
be some other error not just memory error</font>
<br><font size=2 face="sans-serif">if asprintf() fails, so returning </font><tt><font size=2>ENOMEM
is not accurate.</font></tt>
<br><tt><font size=2>Additionally, you still need to verify the numeric
value of ETIMEDOUT because </font></tt>
<br><tt><font size=2>cli_getprstatus() returning 1 in the other code as
follows.</font></tt>
<br><tt><font size=2> if (!mpp)</font></tt>
<br><tt><font size=2>
return 1;</font></tt>
<br><tt><font size=2>And the other called functions also returns 1 if error
occurs, such as cli_suspend,</font></tt>
<br><tt><font size=2>cli_resume.</font></tt>
<br>
<br><tt><font size=2>Thanks </font></tt>
<br><font size=2 face="sans-serif"><br>
</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">发件人:
</font><font size=1 face="sans-serif">Bart Van Assche
<bart.vanassche@sandisk.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">收件人:
</font><font size=1 face="sans-serif"><peng.liang5@zte.com.cn>,
</font>
<br><font size=1 color=#5f5f5f face="sans-serif">抄送:
</font><font size=1 face="sans-serif"><dm-devel@redhat.com>,
<tang.junhui@zte.com.cn>, <zhang.kai16@zte.com.cn></font>
<br><font size=1 color=#5f5f5f face="sans-serif">日期:
</font><font size=1 face="sans-serif">2016/10/14
06:44</font>
<br><font size=1 color=#5f5f5f face="sans-serif">主题:
</font><font size=1 face="sans-serif">Re: [dm-devel]
[PATCH] multipathd: fix issue in 'map $map getprstatus' reply</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>On 10/12/2016 11:30 PM, peng.liang5@zte.com.cn wrote:<br>
> Thanks for your attention. I don't think it is necessary to do that.<br>
> Whatever returning 1 or ENOMEM it will reply "fail\n" and
set the<br>
> returning to 1.<br>
><br>
> The executed code in uxsock_trigger as follows.<br>
> if (r > 0) {<br>
> if (r == ETIMEDOUT)<br>
>
*reply = STRDUP("timeout\n");<br>
> else<br>
>
*reply = STRDUP("fail\n");<br>
> *len = strlen(*reply)
+ 1;<br>
> r = 1;<br>
> }<br>
<br>
Hello Peng,<br>
<br>
Anyone who wants to verify your patch has to look up the numeric value
<br>
of ETIMEDOUT to see whether or not the value of that constant is equal
<br>
to one. So using "return 1" makes the source code harder to read
than <br>
"return ENOMEM". Additionally, it is inconsistent from a stylistic
point <br>
of view that the caller compares the return value with an E... error <br>
code and that the called function returns a numeric constant. So I would
<br>
appreciate it very much if you would change "return 1" into "return
<br>
ENOMEM" or any other symbolic E* error code of your preference.<br>
<br>
Bart.<br>
</font></tt>
<br>