[pgpool-general: 6968] Re: Fix Dead store to local variable
Tatsuo Ishii
ishii at sraoss.co.jp
Sat Apr 11 14:55:55 JST 2020
> Hello,
>
>
> In function send_complete_and_ready(),
> I found the value of 'msg_len' is not read since it was assigned 15.
>
>
> the code is as follows
> ---------src/utils/pool_process_reporting.c:121---------------------------
> 121 if (num_rows >= 0)
> 122 msg_len = snprintf(msg, 16, "%s %d", message, num_rows);
> 123 else
> 124 msg_len = snprintf(msg, 16, "%s", message);
> 125
> 126 /*
> 127 * if we had more than 16 bytes, including '\0', the string was
> 128 * truncatured shouldn't happen though, as it would means more than
> 129 * "SELECT 99999999"
> 130 */
> 131 if (msg_len > 15)
> 132 msg_len = 15;
> 133
> 134 /* complete command response */
> 135 pool_write(frontend, "C", 1);
> 136 if (MAJOR(backend) == PROTO_MAJOR_V3)
> 137 {
> 138 len = htonl(4 + strlen(msg) + 1);
> 139 pool_write(frontend, &len, sizeof(len));
> 140 }
> 141 pool_write(frontend, msg, strlen(msg) + 1);
>
>
>
> I think 'msg_len' can replace 'strlen(msg)' after it , and I make a patch for it.
Yoy are right. Also I found there was unnecessary limitation of number
of rows affected by the command and fix it.Patch committed. Thanks!
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
More information about the pgpool-general
mailing list