From db7fde633fb0eaa315cef7bd30b56e0b2d59b99d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 9 Jul 2013 12:48:04 +0000 Subject: [PATCH] fix warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result] --- gnupg.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gnupg.c b/gnupg.c index 591a25b..87945e5 100644 --- a/gnupg.c +++ b/gnupg.c @@ -412,9 +412,12 @@ gpgme_error_t passphrase_cb (gnupg_object *intern, const char *uid_hint, const c return 1; } - write (fd, passphrase, strlen(passphrase)); - write (fd, "\n", 1); - return 0; + if (write (fd, passphrase, strlen(passphrase))==strlen(passphrase) + && write (fd, "\n", 1)==1) { + return 0; + } + GNUPG_ERR("write failed"); + return 1; } gpgme_error_t passphrase_decrypt_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){ @@ -439,9 +442,12 @@ gpgme_error_t passphrase_decrypt_cb (gnupg_object *intern, const char *uid_hint, GNUPG_ERR("no passphrase set"); return 1; } - write (fd, passphrase, strlen(passphrase)); - write (fd, "\n", 1); - return 0; + if (write (fd, passphrase, strlen(passphrase))==strlen(passphrase) + && write (fd, "\n", 1)==1) { + return 0; + } + GNUPG_ERR("write failed"); + return 1; } /* }}} */