Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Silence compiler warning about pointer type mismatch on some platforms.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 2 Oct 2012 14:37:41 +0000 (17:37 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 2 Oct 2012 14:46:53 +0000 (17:46 +0300)
timeval.t_sec is of type time_t, which is not always compatible with long.
I'm not sure if this was just harmless warning or a real bug, but this
fixes it, anyway.

src/bin/pg_basebackup/receivelog.c

index 0aec5d2f9d23ee9c611caf5e0502a2a29d779b01..805e9b87b32c353778f7e4d6802c8a561ba14f7f 100644 (file)
@@ -420,15 +420,20 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
            if (standby_message_timeout)
            {
                TimestampTz targettime;
+               long        secs;
+               int         usecs;
 
                targettime = TimestampTzPlusMilliseconds(last_status,
                                                standby_message_timeout - 1);
                localTimestampDifference(now,
                                         targettime,
-                                        &timeout.tv_sec,
-                                        (int *) &timeout.tv_usec);
-               if (timeout.tv_sec <= 0)
+                                        &secs,
+                                        &usecs);
+               if (secs <= 0)
                    timeout.tv_sec = 1; /* Always sleep at least 1 sec */
+               else
+                   timeout.tv_sec = secs;
+               timeout.tv_sec = usecs;
                timeoutptr = &timeout;
            }
            else