X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=codemux.c;h=4e4fabe23e1c69809993d15bc17d9cc1eb059141;hb=a445559e39bb43f8a5d63a27e602ac45452f0f80;hp=31a4dfc51d0d1d6433a13dc979633bc96a34b335;hpb=6bab2e9c4912fcad6c03b589128cd35157a87f18;p=codemux.git diff --git a/codemux.c b/codemux.c index 31a4dfc..4e4fabe 100644 --- a/codemux.c +++ b/codemux.c @@ -37,8 +37,8 @@ int defaultTraceSync; among them */ #define FAIRNESS_CUTOFF (MAX_CONNS * 0.85) -/* codemux version */ -#define CODEMUX_VERSION "0.4" +/* codemux version, from Makefile, or specfile */ +#define CODEMUX_VERSION RPM_VERSION typedef struct FlowBuf { int fb_refs; /* num refs */ @@ -457,7 +457,7 @@ static int FindService(FlowBuf *fb, int *whichService, struct in_addr addr) { char *end; - char *lowerBuf; + char lowerBuf[FB_ALLOCSIZE]; char *hostVal; char *buf = fb->fb_buf; char orig[256]; @@ -466,7 +466,7 @@ FindService(FlowBuf *fb, int *whichService, struct in_addr addr) int i; int len; #endif - + if (strstr(buf, "\n\r\n") == NULL && strstr(buf, "\n\n") == NULL) return(FAILURE); @@ -475,7 +475,7 @@ FindService(FlowBuf *fb, int *whichService, struct in_addr addr) fb->fb_used += InsertHeader(buf, fb->fb_used + 1, orig); /* get just the header, so we can work on it */ - LOCAL_STR_DUP_LOWER(lowerBuf, buf); + StrcpyLower(lowerBuf, buf); if ((end = strstr(lowerBuf, "\n\r\n")) == NULL) end = strstr(lowerBuf, "\n\n"); *end = '\0'; @@ -503,7 +503,6 @@ FindService(FlowBuf *fb, int *whichService, struct in_addr addr) DoesDotlessSuffixMatch(hostVal, 0, serviceSig[i].ss_host)) { *whichService = i; free(hostVal); - /* printf("%s", buf); */ return(SUCCESS); } } @@ -1033,19 +1032,8 @@ static int OpenLogFile(void) { static const char* logfile = "/var/log/codemux.log"; - static const char* oldlogfile = "/var/log/codemux.log.old"; int logfd; - /* if the previous log file exists, - rename it to the oldlogfile */ - if (access(logfile, F_OK) == 0) { - if (rename(logfile, oldlogfile) < 0) { - fprintf(stderr, "cannot rotate the logfile err=%s\n", - strerror(errno)); - exit(-1); - } - } - logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT, 0600); if (logfd < 0) { fprintf(stderr, "cannot open the logfile err=%s\n",