X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=blobdiff_plain;f=src%2Fremoted%2Fsyslogtcp.c;h=d4944c01b2a953f257a9ce953a1ede2908d0d026;hb=927951d1c1ad45ba9e7325f07d996154a91c911b;hp=cce947ff065e54aef2cdfb557bed81b73a2c377c;hpb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;p=ossec-hids.git diff --git a/src/remoted/syslogtcp.c b/src/remoted/syslogtcp.c index cce947f..d4944c0 100755 --- a/src/remoted/syslogtcp.c +++ b/src/remoted/syslogtcp.c @@ -58,6 +58,11 @@ static void HandleClient(int client_socket, char *srcip) char *buffer_pt = NULL; + /* Create PID file */ + if(CreatePID(ARGV0, getpid()) < 0) + { + ErrorExit(PID_ERROR,ARGV0); + } /* Initializing some variables */ memset(buffer, '\0', OS_MAXSTR +2); @@ -71,6 +76,7 @@ static void HandleClient(int client_socket, char *srcip) if((r_sz = OS_RecvTCPBuffer(client_socket, buffer, OS_MAXSTR -2)) < 0) { close(client_socket); + DeletePID(ARGV0); return; } @@ -143,7 +149,7 @@ static void HandleClient(int client_socket, char *srcip) if(SendMSG(logr.m_queue, buffer_pt, srcip,SYSLOG_MQ) < 0) { merror(QUEUE_ERROR,ARGV0,DEFAULTQUEUE, strerror(errno)); - if((logr.m_queue = StartMQ(DEFAULTQUEUE,READ)) < 0) + if((logr.m_queue = StartMQ(DEFAULTQUEUE,WRITE)) < 0) { ErrorExit(QUEUE_FATAL,ARGV0,DEFAULTQUEUE); }