|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.192 2002/08/17 12:33:17 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.193 2002/08/18 00:06:01 momjian Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
|
19 | 19 | #include<fcntl.h> |
20 | 20 | #include<errno.h> |
21 | 21 | #include<ctype.h> |
| 22 | +#include<time.h> |
22 | 23 |
|
23 | 24 | #include"libpq-fe.h" |
24 | 25 | #include"libpq-int.h" |
@@ -1078,18 +1079,18 @@ connectDBComplete(PGconn *conn) |
1078 | 1079 | } |
1079 | 1080 |
|
1080 | 1081 |
|
1081 | | -while (NULL==rp||remains.tv_sec>0||remains.tv_sec==0&&remains.tv_usec>0) |
| 1082 | +while (rp==NULL||remains.tv_sec>0||(remains.tv_sec==0&&remains.tv_usec>0)) |
1082 | 1083 | { |
1083 | 1084 | /* |
1084 | 1085 | * If connecting timeout is set, get current time. |
1085 | 1086 | */ |
1086 | | -if (NULL!=rp&&-1==gettimeofday(&start_time,NULL)) |
| 1087 | +if (rp!=NULL&&gettimeofday(&start_time,NULL)==-1) |
1087 | 1088 | { |
1088 | 1089 | conn->status=CONNECTION_BAD; |
1089 | 1090 | return0; |
1090 | 1091 | } |
1091 | 1092 |
|
1092 | | -/* |
| 1093 | +/* |
1093 | 1094 | * Wait, if necessary.Note that the initial state (just after |
1094 | 1095 | * PQconnectStart) is to wait for the socket to select for |
1095 | 1096 | * writing. |
|