Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/pgp.c @ 1598:a087125d8fc8
Replace libjabber with loudmouth
author | franky |
---|---|
date | Sun, 11 Oct 2009 15:38:32 +0200 |
parents | 366ef500c522 |
children | dcd5d4c75199 |
comparison
equal
deleted
inserted
replaced
1597:4f59a414217e | 1598:a087125d8fc8 |
---|---|
148 return NULL; // Shouldn't happen... | 148 return NULL; // Shouldn't happen... |
149 | 149 |
150 return g_strndup(p, q-p); | 150 return g_strndup(p, q-p); |
151 } | 151 } |
152 | 152 |
153 // GCC ignores casts to void, thus we need to hack around that | |
154 static inline void ignore(void*x) {} | |
155 | |
153 // passphrase_cb() | 156 // passphrase_cb() |
154 // GPGME passphrase callback function. | 157 // GPGME passphrase callback function. |
155 static gpgme_error_t passphrase_cb(void *hook, const char *uid_hint, | 158 static gpgme_error_t passphrase_cb(void *hook, const char *uid_hint, |
156 const char *passphrase_info, int prev_was_bad, int fd) | 159 const char *passphrase_info, int prev_was_bad, int fd) |
157 { | 160 { |
158 ssize_t len; | 161 ssize_t len; |
159 | 162 |
160 // Abort if we do not have the password. | 163 // Abort if we do not have the password. |
161 if (!gpg.passphrase) { | 164 if (!gpg.passphrase) { |
162 write(fd, "\n", 1); | 165 ignore((void*)write(fd, "\n", 1)); // We have an error anyway, thus it does |
166 // not matter if we fail again. | |
163 return gpg_error(GPG_ERR_CANCELED); | 167 return gpg_error(GPG_ERR_CANCELED); |
164 } | 168 } |
165 | 169 |
166 // Write the passphrase to the file descriptor. | 170 // Write the passphrase to the file descriptor. |
167 len = strlen(gpg.passphrase); | 171 len = strlen(gpg.passphrase); |