From 4682976242973789982065d403ffd4c7ac73376b Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 15 Apr 2011 17:23:17 +0300 Subject: [PATCH] Logging added for scriptexecuter --- stglibs/scriptexecuter.lib/scriptexecuter.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stglibs/scriptexecuter.lib/scriptexecuter.cpp b/stglibs/scriptexecuter.lib/scriptexecuter.cpp index 6e21a28f..abe0185c 100644 --- a/stglibs/scriptexecuter.lib/scriptexecuter.cpp +++ b/stglibs/scriptexecuter.lib/scriptexecuter.cpp @@ -8,6 +8,7 @@ #include #include +#include "stg/common.h" #include "scriptexecuter.h" using namespace std; @@ -32,14 +33,16 @@ nonstop = false; int ScriptExec(const string & str) { if (str.length() >= MAX_SCRIPT_LEN) + { + printfd(__FILE__, "ScriptExec() - script params exceeds MAX_SCRIPT_LENGTH (%d > %d)\n", str.length(), MAX_SCRIPT_LEN); return -1; + } -int ret; strncpy(sd.script, str.c_str(), MAX_SCRIPT_LEN); sd.mtype = 1; -ret = msgsnd(msgid, (void *)&sd, MAX_SCRIPT_LEN, 0); -if (ret < 0) +if (msgsnd(msgid, (void *)&sd, MAX_SCRIPT_LEN, 0) < 0) { + printfd(__FILE__, "ScriptExec() - failed to send message to the IPC queue: '%s'\n", strerror(errno)); return -1; } return 0; @@ -116,5 +119,3 @@ while (nonstop) } } //----------------------------------------------------------------------------- - - -- 2.44.2