git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed issues in cap_pcap.
[stg.git]
/
stglibs
/
scriptexecuter.lib
/
scriptexecuter.c
diff --git
a/stglibs/scriptexecuter.lib/scriptexecuter.c
b/stglibs/scriptexecuter.lib/scriptexecuter.c
index 021407dde59faf253503f45135eb2b16b52f0c29..728082ae350ba079e5404f4b6a3168eb0e805002 100644
(file)
--- a/
stglibs/scriptexecuter.lib/scriptexecuter.c
+++ b/
stglibs/scriptexecuter.lib/scriptexecuter.c
@@
-1,15
+1,14
@@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
+
#include <stdlib.h>
#include <unistd.h>
#include <stdlib.h>
#include <unistd.h>
-
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
-#include "scriptexecuter.h"
-
+#include "stg/scriptexecuter.h"
#define MAX_SCRIPT_LEN (1100)
#define MAX_SCRIPT_LEN (1100)
@@
-41,27
+40,29
@@
if (msgsnd(msgid, (void *)&sd, MAX_SCRIPT_LEN, 0) < 0)
return 0;
}
//-----------------------------------------------------------------------------
return 0;
}
//-----------------------------------------------------------------------------
-#if
def LINUX
+#if
defined(LINUX) || defined(DARWIN)
void Executer(int msgID, pid_t pid, char * procName)
#else
void Executer(int msgID, pid_t pid)
#endif
{
void Executer(int msgID, pid_t pid, char * procName)
#else
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;
nonstop = 1;
msgid = msgID;
if (pid)
return;
nonstop = 1;
-#if
def LINUX
+#if
defined(LINUX) || defined(DARWIN)
memset(procName, 0, strlen(procName));
strcpy(procName, "stg-exec");
#else
setproctitle("stg-exec");
#endif
memset(procName, 0, strlen(procName));
strcpy(procName, "stg-exec");
#else
setproctitle("stg-exec");
#endif
-struct sigaction newsa, oldsa;
-sigset_t sigmask;
-
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGTERM);
newsa.sa_handler = SIG_IGN;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGTERM);
newsa.sa_handler = SIG_IGN;
@@
-90,10
+91,6
@@
newsa.sa_mask = sigmask;
newsa.sa_flags = 0;
sigaction(SIGUSR1, &newsa, &oldsa);
newsa.sa_flags = 0;
sigaction(SIGUSR1, &newsa, &oldsa);
-int ret;
-
-struct SCRIPT_DATA sd;
-
while (nonstop)
{
sd.mtype = 1;
while (nonstop)
{
sd.mtype = 1;
@@
-104,7
+101,7
@@
while (nonstop)
usleep(20000);
continue;
}
usleep(20000);
continue;
}
-
int
ret = system(sd.script);
+ ret = system(sd.script);
if (ret == -1)
{
// Fork failed
if (ret == -1)
{
// Fork failed