after log error, reset errno
This commit is contained in:
@@ -486,6 +486,8 @@ static int health_check(struct key_keeper *keeper)
|
||||
if (sockfd == -1)
|
||||
{
|
||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to create socket(), %s", strerror(errno));
|
||||
/* after log, reset errno */
|
||||
errno = 0;
|
||||
goto error;
|
||||
}
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
@@ -495,16 +497,22 @@ static int health_check(struct key_keeper *keeper)
|
||||
if (connect(sockfd, (const struct sockaddr *)&addr, sizeof(addr)) == -1)
|
||||
{
|
||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to connect(), %s", strerror(errno));
|
||||
/* after log, reset errno */
|
||||
errno = 0;
|
||||
goto error;
|
||||
}
|
||||
if (write(sockfd, req_buff, strlen(req_buff)) == -1)
|
||||
{
|
||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to write(), %s", strerror(errno));
|
||||
/* after log, reset errno */
|
||||
errno = 0;
|
||||
goto error;
|
||||
}
|
||||
if (read(sockfd, rsp_buff, sizeof(rsp_buff)) == -1)
|
||||
{
|
||||
TFE_LOG_ERROR(keeper->logger, "CertStore health check thread fail to read(), %s", strerror(errno));
|
||||
/* after log, reset errno */
|
||||
errno = 0;
|
||||
goto error;
|
||||
}
|
||||
close(sockfd);
|
||||
@@ -606,6 +614,8 @@ struct key_keeper* key_keeper_init(const char * profile, const char* section, vo
|
||||
if (unlikely(ret < 0))
|
||||
{
|
||||
TFE_LOG_ERROR(keeper->logger, "Failed at creating certstore health check thread: %s", strerror(errno));
|
||||
/* after log, reset errno */
|
||||
errno = 0;
|
||||
goto error_out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user