From: Maxim Mamontov Date: Fri, 15 Apr 2011 14:23:17 +0000 (+0300) Subject: Logging added for scriptexecuter X-Git-Tag: 2.407~4 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/4682976242973789982065d403ffd4c7ac73376b?ds=inline Logging added for scriptexecuter --- 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) } } //----------------------------------------------------------------------------- - -