Re: compile warnings in CVS - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: compile warnings in CVS
Date
Msg-id 200208180005.g7I05nL13938@candle.pha.pa.us
Whole thread Raw
In response to compile warnings in CVS  (Neil Conway <nconway@klamath.dyndns.org>)
List pgsql-hackers
OK, I have fixed the first two with the following patch.  The second
pair Tom has commented on.

---------------------------------------------------------------------------

Neil Conway wrote:
> I get the following compiling the current CVS code with gcc 3.1:
>
> ...
> fe-connect.c: In function `connectDBComplete':
> fe-connect.c:1081: warning: suggest parentheses around && within ||
> fe-connect.c:1086: warning: implicit declaration of function `gettimeofday'
> ...
> pg_controldata.c: In function `main':
> pg_controldata.c:91: warning: `%c' yields only last 2 digits of year in some locales
> pg_controldata.c:93: warning: `%c' yields only last 2 digits of year in some locales
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilconway@rogers.com>
> PGP Key ID: DB3C29FC
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  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
Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.192
diff -c -r1.192 fe-connect.c
*** src/interfaces/libpq/fe-connect.c    17 Aug 2002 12:33:17 -0000    1.192
--- src/interfaces/libpq/fe-connect.c    18 Aug 2002 00:04:07 -0000
***************
*** 19,24 ****
--- 19,25 ----
  #include <fcntl.h>
  #include <errno.h>
  #include <ctype.h>
+ #include <time.h>

  #include "libpq-fe.h"
  #include "libpq-int.h"
***************
*** 1078,1095 ****
        }


!       while (NULL == rp || remains.tv_sec > 0 || remains.tv_sec == 0 && remains.tv_usec > 0)
        {
          /*
                 * If connecting timeout is set, get current time.
                 */
!               if ( NULL != rp && -1 == gettimeofday(&start_time, NULL))
                {
                        conn->status = CONNECTION_BAD;
                        return 0;
                }

!               /*
           * Wait, if necessary.    Note that the initial state (just after
           * PQconnectStart) is to wait for the socket to select for
           * writing.
--- 1079,1096 ----
        }


!       while (rp == NULL || remains.tv_sec > 0 || (remains.tv_sec == 0 && remains.tv_usec > 0))
        {
          /*
                 * If connecting timeout is set, get current time.
                 */
!               if (rp != NULL && gettimeofday(&start_time, NULL) == -1)
                {
                        conn->status = CONNECTION_BAD;
                        return 0;
                }

!         /*
           * Wait, if necessary.    Note that the initial state (just after
           * PQconnectStart) is to wait for the socket to select for
           * writing.

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Open 7.3 items
Next
From: Bruce Momjian
Date:
Subject: Re: compile warnings in CVS