- fixed stroke error output to starter

This commit is contained in:
Martin Willi
2006-05-10 07:11:52 +00:00
parent 2192375bc8
commit 37a2b616e2
3 changed files with 88 additions and 87 deletions
+1 -1
View File
@@ -520,7 +520,7 @@ static void stroke_receive(private_stroke_t *this)
continue; continue;
} }
/* TODO: BAD: does not work for starter, charon crashes!! FIX this */ /* setup a logger which writes status to the unix socket */
this->stroke_logger = logger_create("-", CONTROL|ERROR, FALSE, strokefile); this->stroke_logger = logger_create("-", CONTROL|ERROR, FALSE, strokefile);
this->logger->log_bytes(this->logger, RAW, "stroke message", (void*)msg, msg_length); this->logger->log_bytes(this->logger, RAW, "stroke message", (void*)msg, msg_length);
@@ -55,16 +55,6 @@ typedef struct stroke_t stroke_t;
*/ */
struct stroke_t { struct stroke_t {
/**
* Implements policy_store_t interface
*/
policy_store_t policies;
/**
* Implements credential_store_t interfacce
*/
credential_store_t credentials;
/** /**
* @brief Destroy a stroke_t instance. * @brief Destroy a stroke_t instance.
* *
+11
View File
@@ -61,6 +61,8 @@ send_stroke_msg (stroke_msg_t *msg)
{ {
struct sockaddr_un ctl_addr = { AF_UNIX, CHARON_CTL_FILE }; struct sockaddr_un ctl_addr = { AF_UNIX, CHARON_CTL_FILE };
int sock; int sock;
int byte_count;
char buffer[64];
sock = socket(AF_UNIX, SOCK_STREAM, 0); sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0) if (sock < 0)
@@ -83,6 +85,15 @@ send_stroke_msg (stroke_msg_t *msg)
close(sock); close(sock);
return -1; return -1;
} }
while ((byte_count = read(sock, buffer, sizeof(buffer)-1)) > 0)
{
buffer[byte_count] = '\0';
plog("%s", buffer);
}
if (byte_count < 0)
{
plog(stderr, "read() failed: %s", strerror(errno));
}
close(sock); close(sock);
return 0; return 0;