- fixed stroke error output to starter
This commit is contained in:
@@ -520,7 +520,7 @@ static void stroke_receive(private_stroke_t *this)
|
||||
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->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 {
|
||||
|
||||
/**
|
||||
* Implements policy_store_t interface
|
||||
*/
|
||||
policy_store_t policies;
|
||||
|
||||
/**
|
||||
* Implements credential_store_t interfacce
|
||||
*/
|
||||
credential_store_t credentials;
|
||||
|
||||
/**
|
||||
* @brief Destroy a stroke_t instance.
|
||||
*
|
||||
|
||||
@@ -61,6 +61,8 @@ send_stroke_msg (stroke_msg_t *msg)
|
||||
{
|
||||
struct sockaddr_un ctl_addr = { AF_UNIX, CHARON_CTL_FILE };
|
||||
int sock;
|
||||
int byte_count;
|
||||
char buffer[64];
|
||||
|
||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sock < 0)
|
||||
@@ -83,6 +85,15 @@ send_stroke_msg (stroke_msg_t *msg)
|
||||
close(sock);
|
||||
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);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user