Re: Diff for src/interfaces/libpq/fe-connect.c between version

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Denis A Ustimenko <denis(at)oldham(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Diff for src/interfaces/libpq/fe-connect.c between version
Date: 2002-10-11 04:10:42
Message-ID: 200210110410.g9B4Ahu15623@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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(at)candle(dot)pha(dot)pa(dot)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(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 8.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-10-11 05:17:02 Re: [Fwd: Re: [JDBC] Patch for handling "autocommit=false"
Previous Message Bruce Momjian 2002-10-11 03:48:54 Re: Diff for src/interfaces/libpq/fe-connect.c between version 1.195