Index: policykit-1-0.94/src/polkitagent/polkitagentsession.c =================================================================== --- policykit-1-0.94.orig/src/polkitagent/polkitagentsession.c 2009-10-10 12:03:20.000000000 +0100 +++ policykit-1-0.94/src/polkitagent/polkitagentsession.c 2009-10-10 12:03:42.000000000 +0100 @@ -56,6 +56,7 @@ #include #include #include +#include #include "polkitagentmarshal.h" #include "polkitagentsession.h" @@ -407,6 +408,8 @@ gboolean add_newline; size_t response_len; const char newline[] = "\n"; + ssize_t written; + ssize_t offset = 0; g_return_if_fail (response != NULL); @@ -414,9 +417,39 @@ add_newline = (response[response_len] != '\n'); - write (session->child_stdin, response, response_len); - if (add_newline) - write (session->child_stdin, newline, 1); + do { + written = write(session->child_stdin, response + offset, response_len - offset); + if (written == response_len) + break; + if (written > 0) { + offset += written; + } + } while (written >= 0 || errno == EINTR); + + if (written < 0) { + g_warning ("Error passing password to polkit-agent-helper-1\n"); + goto error; + } + + if (add_newline) { + do { + written = write(session->child_stdin, newline, 1); + if (written > 0) { + break; + } + } while (written >= 0 || errno == EINTR); + + if (written < 0) { + g_warning ("Error passing password to polkit-agent-helper-1\n"); + goto error; + } + } + + return; + +error: + complete_session (session, FALSE); + } /**