Re: Diff for src/interfaces/libpq/fe-connect.c between version 1.195
Denis A Ustimenko wrote:
Hello Bruce!
You have patched fe-connect.c and dropeed out one check in line 1078:
< while (rp == NULL || remains.tv_sec > 0 || (remains.tv_sec == 0 && remains.tv_usec > 0))
---while (rp == NULL || remains.tv_sec > 0 || remains.tv_usec > 0)
As I understand it is dangerous. The remains.tv_usec can be greater than zero while remains.tv_sec is below zero. It must exit form the loop in that conditions.
[ CC to hackers.]
Well, I can see how it could go negative, but if that happens, we have a
bigger problem. tv_sec on my system is an unsigned int, so I think the
value will show as huge rather than negative. If you want negative
values, I think you are going to need to use a real signed integer.
Would you send a context diff (diff -c) against CVS with a fix?
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Import Notes
Reply to msg id not found: 20021011033820.GA2320@store.oldham.ru
OK, I have applied the following patch which should fix the problem by
preventing tv_sec from becoming negative.
---------------------------------------------------------------------------
Bruce Momjian wrote:
Denis A Ustimenko wrote:
Hello Bruce!
You have patched fe-connect.c and dropeed out one check in line 1078:
< while (rp == NULL || remains.tv_sec > 0 || (remains.tv_sec == 0 && remains.tv_usec > 0))
---while (rp == NULL || remains.tv_sec > 0 || remains.tv_usec > 0)
As I understand it is dangerous. The remains.tv_usec can be greater than zero while remains.tv_sec is below zero. It must exit form the loop in that conditions.
[ CC to hackers.]
Well, I can see how it could go negative, but if that happens, we have a
bigger problem. tv_sec on my system is an unsigned int, so I think the
value will show as huge rather than negative. If you want negative
values, I think you are going to need to use a real signed integer.
Would you send a context diff (diff -c) against CVS with a fix?-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073