]> granicus.if.org Git - postgresql/commitdiff
Tweak streamutil.c further to avoid scan-build warning
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 22 Nov 2013 02:46:43 +0000 (21:46 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 22 Nov 2013 02:46:43 +0000 (21:46 -0500)
The previous change added a new scan-build warning about need_password
assigned but not read.

src/bin/pg_basebackup/streamutil.c

index 67917512e25cebca0ce26e0101dbb39d9cfea50d..6cc6cd200e627aff53d1196cfd6e16e5e67aa22d 100644 (file)
@@ -117,7 +117,7 @@ GetConnection(void)
        /* If -W was given, force prompt for password, but only the first time */
        need_password = (dbgetpassword == 1 && dbpassword == NULL);
 
-       while (true)
+       do
        {
                /* Get a new password if appropriate */
                if (need_password)
@@ -161,9 +161,8 @@ GetConnection(void)
                        PQfinish(tmpconn);
                        need_password = true;
                }
-               else
-                       break;
        }
+       while (need_password);
 
        if (PQstatus(tmpconn) != CONNECTION_OK)
        {