aboutsummaryrefslogtreecommitdiffstats
path: root/context.cpp
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2009-01-04 00:42:36 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2009-01-04 00:42:36 +0000
commitf43fb4b467c19e94e8c51d78600fd6355edef68e (patch)
tree0089551ab901a3edf6941418d1550c67050231e4 /context.cpp
parentadded expire date in key generation (diff)
downloadgpg4usb-f43fb4b467c19e94e8c51d78600fd6355edef68e.tar.gz
gpg4usb-f43fb4b467c19e94e8c51d78600fd6355edef68e.zip
added file en-/decryption dialog
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@204 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to '')
-rw-r--r--context.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/context.cpp b/context.cpp
index cf20073..846cf36 100644
--- a/context.cpp
+++ b/context.cpp
@@ -352,7 +352,7 @@ gpgme_error_t Context::passphrase(const char *uid_hint,
const char * /*passphrase_info*/,
int last_was_bad, int fd)
{
- gpgme_error_t res = GPG_ERR_CANCELED;
+ gpgme_error_t returnValue = GPG_ERR_CANCELED;
QString s;
QString gpg_hint = uid_hint;
bool result;
@@ -374,27 +374,34 @@ gpgme_error_t Context::passphrase(const char *uid_hint,
s, QLineEdit::Password,
"", &result);
- if (result == 1) m_cache = password.toAscii();
+ if (result) m_cache = password.toAscii();
} else
- result = 0;
+ result = false;
+
+ if (result) {
- if (result == 1) {
#ifndef _WIN32
- write(fd, m_cache.data(), m_cache.length());
+ if( write(fd, m_cache.data(), m_cache.length()) == -1) {
+ qDebug() << "something is terribly broken";
+ }
#else
DWORD written;
WriteFile((HANDLE) fd, m_cache.data(), m_cache.length(), &written, 0);
#endif
- res = 0;
+
+ returnValue = 0;
}
+
#ifndef _WIN32
- write(fd, "\n", 1);
+ if( write(fd, "\n", 1) == -1 ) {
+ qDebug() << "something is terribly broken";
+ }
#else
DWORD written;
WriteFile((HANDLE) fd, "\n", 1, &written, 0);
#endif
- return res;
+ return returnValue;
}
/** also from kgpgme.cpp, seems to clear password from mem */