PRSocketOptionData sockopts;
PRPollDesc pollfds[2];
gboolean nonblock;
- gint error;
+ gint saved_errno;
/* get O_NONBLOCK options */
sockopts.option = PR_SockOpt_Nonblocking;
/* restore O_NONBLOCK options */
failed:
- error = errno;
+ saved_errno = errno;
sockopts.option = PR_SockOpt_Nonblocking;
sockopts.value.non_blocking = nonblock;
PR_SetSocketOption (fd, &sockopts);
- errno = error;
+ errno = saved_errno;
}
if (nread == -1)
PRSocketOptionData sockopts;
PRPollDesc pollfds[2];
gboolean nonblock;
- gint error;
+ gint saved_errno;
/* get O_NONBLOCK options */
sockopts.option = PR_SockOpt_Nonblocking;
} while (w != -1 && written < n);
/* restore O_NONBLOCK options */
- error = errno;
+ saved_errno = errno;
sockopts.option = PR_SockOpt_Nonblocking;
sockopts.value.non_blocking = nonblock;
PR_SetSocketOption (fd, &sockopts);
- errno = error;
+ errno = saved_errno;
}
- if (w == -1)
+ if (w == -1) {
_set_g_error_from_errno (error, TRUE);
+ written = -1;
+ }
return written;
}
cancellable, &local_error);
if (!authenticated) {
if (g_cancellable_is_cancelled (cancellable) ||
- g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE))
+ g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE)) {
+ g_free (service->url->passwd);
+ service->url->passwd = NULL;
+
+ if (local_error)
+ g_clear_error (&local_error);
+
return FALSE;
+ }
errbuf = g_markup_printf_escaped (
_("Unable to authenticate "
"to SMTP server.\n%s\n\n"),
- local_error->message);
+ local_error ? local_error->message : _("Unknown error"));
g_clear_error (&local_error);
g_free (service->url->passwd);