Re: [PATCH] multipathd: fix issue in 'map $map getprstatus' reply

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Bart,

I can understand your concern. It may be some other error not just memory error
if asprintf() fails, so returning ENOMEM is not accurate.
Additionally, you still need to verify the numeric value of ETIMEDOUT because
cli_getprstatus() returning 1 in the other code as follows.
        if (!mpp)
                return 1;
And the other called functions also returns 1 if error occurs, such as cli_suspend,
cli_resume.

Thanks  





发件人:         Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
收件人:         <peng.liang5@xxxxxxxxxx>,
抄送:        <dm-devel@xxxxxxxxxx>, <tang.junhui@xxxxxxxxxx>, <zhang.kai16@xxxxxxxxxx>
日期:         2016/10/14 06:44
主题:        Re: [dm-devel] [PATCH] multipathd: fix issue in 'map $map getprstatus' reply




On 10/12/2016 11:30 PM, peng.liang5@xxxxxxxxxx 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.

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux