X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/18790478b4e1bf5b005a2c85936558e0e659a80f..bdea0743e4f42352a813c2da3c267dcca6d6871c:/puttygen.c diff --git a/puttygen.c b/puttygen.c index aea9ffee..9b360905 100644 --- a/puttygen.c +++ b/puttygen.c @@ -22,7 +22,6 @@ /* * TODO: - * - check the return value from saversakey() * - test the generated keys for actual working-RSA-key-hood * - variable key size */ @@ -508,9 +507,9 @@ static int CALLBACK MainDlgProc (HWND hwnd, UINT msg, } if (prompt_keyfile(hwnd, "Save private key as:", filename, 1)) { + int ret; FILE *fp = fopen(filename, "r"); if (fp) { - int ret; char buffer[FILENAME_MAX+80]; fclose(fp); sprintf(buffer, "Overwrite existing file\n%.*s?", @@ -520,9 +519,13 @@ static int CALLBACK MainDlgProc (HWND hwnd, UINT msg, if (ret != IDYES) break; } - saversakey(filename, &state->key, &state->aux, - *passphrase ? passphrase : NULL); - /* FIXME: check return value */ + ret = saversakey(filename, &state->key, &state->aux, + *passphrase ? passphrase : NULL); + if (ret <= 0) { + MessageBox(hwnd, "Unable to save key file", + "PuTTYgen Error", + MB_OK | MB_ICONERROR); + } } } break;