Perl doesn't allow last in a do loop
authorJamie Cameron <jcameron@webmin.com>
Mon, 29 Dec 2008 18:54:08 +0000 (18:54 +0000)
committerJamie Cameron <jcameron@webmin.com>
Mon, 29 Dec 2008 18:54:08 +0000 (18:54 +0000)
postgresql/postgresql-lib.pl

index 0cbd602..7c8c81a 100644 (file)
@@ -398,7 +398,7 @@ else {
                     (!&supports_pgpass() ? " -u" : " -U $postgres_login").
                     " -c ".&quote_path($sql)." $host $_[0]";
        if ($postgres_sameunix && defined(getpwnam($postgres_login))) {
-               $cmd = "su $postgres_login -c ".quotemeta($cmd);
+               $cmd = &command_as_user($postgres_login, 0, $cmd);
                }
        $cmd = &command_with_login($cmd);
 
@@ -419,9 +419,9 @@ else {
                local ($line, $rv, @data);
                do {
                        $line = <OUT>;
-                       last if (!defined($line));
                        } while($line =~ /^(username|password|user name):/i ||
-                               $line =~ /(warning|notice):/i || $line !~ /\S/);
+                               $line =~ /(warning|notice):/i ||
+                               $line !~ /\S/ && defined($line));
                unlink($temp);
                if ($line =~ /^ERROR:\s+(.*)/ || $line =~ /FATAL.*:\s+(.*)/) {
                        &error(&text('esql', "<tt>$sql</tt>", "<tt>$1</tt>"));