From 1cf6f14c5a302d8c55bbbcb52b75c8dad12a2d7a Mon Sep 17 00:00:00 2001 From: Anjan Rayamajhi <18730915+arayama@users.noreply.github.com> Date: Fri, 14 Jan 2022 16:16:46 -0500 Subject: [PATCH] bug fixes (#312) --- .../src/MessageReceiverPlugin.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/v2i-hub/MessageReceiverPlugin/src/MessageReceiverPlugin.cpp b/src/v2i-hub/MessageReceiverPlugin/src/MessageReceiverPlugin.cpp index 4c3f56fab..05d06275e 100644 --- a/src/v2i-hub/MessageReceiverPlugin/src/MessageReceiverPlugin.cpp +++ b/src/v2i-hub/MessageReceiverPlugin/src/MessageReceiverPlugin.cpp @@ -493,17 +493,17 @@ int MessageReceiverPlugin::Main() const char *cmd=cmd1.c_str(); char buffer[2048]; std::string result=""; - FILE* pipe= popen(cmd,"r"); + FILE* pipemsg= popen(cmd,"r"); - if (pipe == NULL ) throw std::runtime_error("popen() failed!"); + if (pipemsg == NULL ) throw std::runtime_error("popen() failed!"); try{ - while (fgets(buffer, sizeof(buffer),pipe) != NULL) + while (fgets(buffer, sizeof(buffer),pipemsg) != NULL) { result+=buffer; } } catch (...) { - pclose(pipe); + pclose(pipemsg); throw; } cJSON *root = cJSON_Parse(result.c_str()); @@ -603,7 +603,7 @@ int MessageReceiverPlugin::Main() } } - this->IncomingMessage(extractedpayload.data(), txlen, enc.empty() ? NULL : enc.c_str(), 0, 0, time); + this->IncomingMessage(extractedpayload.data(), txlen, enc.empty() ? nullptr : enc.c_str(), 0, 0, time); } else if (len < 0)