[Homeros] Voiceman. Небольшой фикс

Дмитрий Падучих dpaduchikh на gmail.com
Пн Окт 17 10:34:04 UTC 2011


Предупреждение при компиляции Voiceman:

g++ -DPACKAGE_NAME=\"voiceman\" -DPACKAGE_TARNAME=\"voiceman\" -DPACKAGE_VERSION=\"1.5.0.1\" -DPACKAGE_STRING=\"voiceman\ 1.5.0.1\" -DPACKAGE_BUGREPORT=\"msp на altlinux.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"voiceman\" -DVERSION=\"1.5.0.1\" -I.    -Wall -pedantic -fpic -fno-rtti  -DVOICEMAN_DATADIR=\"/usr/local/share/voiceman\" -DVOICEMAN_DEFAULT_EXECUTOR=\"/usr/local/bin/voiceman-executor\" -DVOICEMAN_DEFAULT_SOCKET=\"/tmp/voiceman.socket\" -DVOICEMAN_DEFAULT_PORT=5511 -DVOICEMAN_DEFAULT_CONFIG=\"/usr/local/etc/voiceman.conf\" -I../../utils -I../../executors -I../../daemon -O2 -MT ExecutorInterface.o -MD -MP -MF .deps/ExecutorInterface.Tpo -c -o ExecutorInterface.o ExecutorInterface.cpp
ExecutorInterface.cpp: In member function ‘void ExecutorInterface::runExecutor()’:
ExecutorInterface.cpp:169:66: warning: missing sentinel in function call [-Wformat]

Дело в том, что g++ 4.6 подставляет вместо NULL просто 0. В результате
вызов execlp выглядит так:

daemon/core$ g++ -E -I. -I../../utils -I../../executors -I../../daemon ExecutorInterface.cpp | grep execlp
...
      if (execlp("/bin/sh", "/bin/sh", "-c", m_executorName.c_str(), 0) == -1)

0 типа int, поэтому необходим каст.

diff --git a/daemon/core/ExecutorInterface.cpp b/daemon/core/ExecutorInterface.cpp
index 2422c90..9e5e6ae 100644
--- a/daemon/core/ExecutorInterface.cpp
+++ b/daemon/core/ExecutorInterface.cpp
@@ -166,7 +166,7 @@ void ExecutorInterface::runExecutor()
       dup2(pp[0], STDIN_FILENO);
       dup2(m_outputPipe[1], STDOUT_FILENO);
       dup2(m_errorPipe[1], STDERR_FILENO);
-      if (execlp(SHELL, SHELL, "-c", m_executorName.c_str(), NULL) == -1)
+      if (execlp(SHELL, SHELL, "-c", m_executorName.c_str(), (char *)NULL) == -1)
 	exit(EXIT_FAILURE);
     } // child process;
   close(pp[0]);

-- 
Дмитрий Падучих


Подробная информация о списке рассылки Homeros