diff --git a/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.c b/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.c index 41633482..9a31c0fb 100755 --- a/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.c +++ b/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016, Wind River Systems, Inc. + * Copyright (c) 2013-2018, Wind River Systems, Inc. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -119,3 +119,19 @@ int guest_utils_json_get_value( struct json_object* jobj, return 0; } // **************************************************************************** + +// **************************************************************************** +// Guest Utilities - replace newline with space +// ====================== +char* guest_utils_remove_newline( char* str) +{ + char match = '\n'; + char replace = ' '; + char *match_found = strchr(str, match); + while (match_found){ + *match_found = replace; + match_found = strchr(match_found+1, match); + } + return str; +} +// **************************************************************************** \ No newline at end of file diff --git a/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.h b/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.h index 25b75b67..313ae2eb 100755 --- a/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.h +++ b/guest-client/guest-client-3.0.1/guest_client/src/guest_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016, Wind River Systems, Inc. + * Copyright (c) 2013-2018, Wind River Systems, Inc. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -56,6 +56,11 @@ extern char* guest_utils_basename( char* str ); // ========================================= extern int guest_utils_json_get_value( struct json_object* jobj, const char* key, void * value ); + +// **************************************************************************** +// Guest Utilities - replace newline with space +// ====================== +char* guest_utils_remove_newline( char* str); // **************************************************************************** #ifdef __cplusplus diff --git a/guest-client/guest-client-3.0.1/guest_client/src/heartbeat/guest_heartbeat_msg.c b/guest-client/guest-client-3.0.1/guest_client/src/heartbeat/guest_heartbeat_msg.c index 11df2feb..87aa977d 100755 --- a/guest-client/guest-client-3.0.1/guest_client/src/heartbeat/guest_heartbeat_msg.c +++ b/guest-client/guest-client-3.0.1/guest_client/src/heartbeat/guest_heartbeat_msg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016, Wind River Systems, Inc. + * Copyright (c) 2013-2018, Wind River Systems, Inc. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -382,7 +382,8 @@ GuestErrorT guest_heartbeat_msg_send_exit( char log_msg[] ) GuestErrorT error; char log_msg_buf[GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE]; - snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", log_msg); + snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", + guest_utils_remove_newline(log_msg)); char msg[GUEST_HEARTBEAT_MSG_MAX_MSG_SIZE]; snprintf(msg, sizeof(msg), "\n{\"%s\":%d,\"%s\":%d,\"%s\":\"%s\",\"%s\":%d," @@ -456,7 +457,8 @@ GuestErrorT guest_heartbeat_msg_send_challenge_response( GuestErrorT error; char log_msg_buf[GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE]; - snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", log_msg); + snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", + guest_utils_remove_newline(log_msg)); char msg[GUEST_HEARTBEAT_MSG_MAX_MSG_SIZE]; snprintf(msg, sizeof(msg), "\n{\"%s\":%d,\"%s\":%d,\"%s\":\"%s\",\"%s\":%d," @@ -543,7 +545,8 @@ GuestErrorT guest_heartbeat_msg_send_action_response( GuestErrorT error; char log_msg_buf[GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE]; - snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", log_msg); + snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", + guest_utils_remove_newline(log_msg)); char msg[GUEST_HEARTBEAT_MSG_MAX_MSG_SIZE]; @@ -852,7 +855,7 @@ void guest_heartbeat_msg_dispatch(json_object *jobj_msg) if (guest_utils_json_get_value(jobj_msg, GUEST_HEARTBEAT_MSG_VERSION, &version)) return; - if (GUEST_HEARTBEAT_MSG_VERSION_CURRENT != version) + if (GUEST_HEARTBEAT_MSG_VERSION_CURRENT > version) { DPRINTFI("message received version %d, expected %d, dropping\n", version, GUEST_HEARTBEAT_MSG_VERSION_CURRENT);