Improvements to PuTTYgen error reporting:
[u/mdw/putty] / cmdgen.c
index 5042aa4..83a158d 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -739,15 +739,14 @@ int main(int argc, char **argv)
 
          case SSH_KEYTYPE_OPENSSH:
          case SSH_KEYTYPE_SSHCOM:
-           ssh2key = import_ssh2(&infilename, intype, passphrase);
-           if (ssh2key && ssh2key != SSH2_WRONG_PASSPHRASE)
-               error = NULL;
-           else if (!error) {
-               if (ssh2key == SSH2_WRONG_PASSPHRASE)
-                   error = "wrong passphrase";
+           ssh2key = import_ssh2(&infilename, intype, passphrase, &error);
+           if (ssh2key) {
+               if (ssh2key != SSH2_WRONG_PASSPHRASE)
+                   error = NULL;
                else
-                   error = "unknown error";
-           }
+                   error = "wrong passphrase";
+           } else if (!error)
+               error = "unknown error";
            break;
 
          default: