From 49696df16652f10a0cc7a7391a270bf12dc26c06 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 20 Sep 2011 16:04:51 +0300 Subject: [PATCH] Move variables declaration to the beginning of the function (old C) --- stglibs/scriptexecuter.lib/scriptexecuter.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/stglibs/scriptexecuter.lib/scriptexecuter.c b/stglibs/scriptexecuter.lib/scriptexecuter.c index 462d310b..bf45105a 100644 --- a/stglibs/scriptexecuter.lib/scriptexecuter.c +++ b/stglibs/scriptexecuter.lib/scriptexecuter.c @@ -46,6 +46,11 @@ void Executer(int msgID, pid_t pid, char * procName) void Executer(int msgID, pid_t pid) #endif { +int ret; +struct SCRIPT_DATA sd; +struct sigaction newsa, oldsa; +sigset_t sigmask; + msgid = msgID; if (pid) return; @@ -58,9 +63,6 @@ strcpy(procName, "stg-exec"); setproctitle("stg-exec"); #endif -struct sigaction newsa, oldsa; -sigset_t sigmask; - sigemptyset(&sigmask); sigaddset(&sigmask, SIGTERM); newsa.sa_handler = SIG_IGN; @@ -89,10 +91,6 @@ newsa.sa_mask = sigmask; newsa.sa_flags = 0; sigaction(SIGUSR1, &newsa, &oldsa); -int ret; - -struct SCRIPT_DATA sd; - while (nonstop) { sd.mtype = 1; @@ -103,7 +101,7 @@ while (nonstop) usleep(20000); continue; } - int ret = system(sd.script); + ret = system(sd.script); if (ret == -1) { // Fork failed -- 2.44.2