diff options
author | Werner Koch <[email protected]> | 2016-09-13 18:46:41 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-09-13 18:46:41 +0000 |
commit | 4491ef0a9a15d3b307d1ade37ff620ef9fcb2478 (patch) | |
tree | 77fb1d5d29642ab7efa62d4a5e02d004f041b9b1 /tests/run-support.h | |
parent | core: Do not pass const char* to functions taking a char*. (diff) | |
download | gpgme-4491ef0a9a15d3b307d1ade37ff620ef9fcb2478.tar.gz gpgme-4491ef0a9a15d3b307d1ade37ff620ef9fcb2478.zip |
tests: Use gpgme_io_write in passhrase callbacks.
* tests/gpg/t-support.h (passphrase_cb): Use gpgme_io_write.
* tests/gpgsm/t-support.h (passphrase_cb): Ditto.
* tests/run-support.h (passphrase_cb): Ditto.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tests/run-support.h')
-rw-r--r-- | tests/run-support.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/run-support.h b/tests/run-support.h index b1aea4be..e4a4f703 100644 --- a/tests/run-support.h +++ b/tests/run-support.h @@ -75,27 +75,25 @@ gpgme_error_t passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info, int last_was_bad, int fd) { -#ifdef HAVE_W32_SYSTEM - DWORD written; - WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0); -#else int res; - char *pass = "abc\n"; + char pass[] = "abc\n"; int passlen = strlen (pass); int off = 0; + (void)opaque; + (void)uid_hint; + (void)passphrase_info; + (void)last_was_bad; + do { - res = write (fd, &pass[off], passlen - off); + res = gpgme_io_write (fd, &pass[off], passlen - off); if (res > 0) off += res; } while (res > 0 && off != passlen); return off == passlen ? 0 : gpgme_error_from_errno (errno); -#endif - - return 0; } |