mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 04:11:59 +01:00
refactoring
This commit is contained in:
parent
f17e50d3a7
commit
b05ddbf571
@ -19,8 +19,8 @@ int string_parser(char *src, char *target, int limit){
|
||||
|
||||
int multi_line_string_parser(char *src, char *target, int limit){
|
||||
if(strlen(src) > 0 && strlen(target) + strlen(src) + 3 < limit){
|
||||
strncat(target, src, limit);
|
||||
strncat(target, "\r\n", limit);
|
||||
strncat(target, src, limit-strlen(target));
|
||||
strncat(target, "\r\n", limit-strlen(target));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -225,8 +225,8 @@ int memcached_add(struct memcached_server *ptr, char *key, unsigned int keylen,
|
||||
snprintf(ptr->buf, MAXBUFSIZE-1, "add %s %d %ld %d \r\n", key, flags, expiry, valuelen);
|
||||
len = strlen(ptr->buf);
|
||||
|
||||
strncat(ptr->buf, value, MAXBUFSIZE-1);
|
||||
strncat(ptr->buf, "\r\n", MAXBUFSIZE-1);
|
||||
strncat(ptr->buf, value, MAXBUFSIZE-strlen(ptr->buf)-1);
|
||||
strncat(ptr->buf, "\r\n", MAXBUFSIZE-strlen(ptr->buf)-1);
|
||||
|
||||
len += valuelen + 2;
|
||||
|
||||
@ -248,8 +248,8 @@ int memcached_set(struct memcached_server *ptr, char *key, unsigned int keylen,
|
||||
snprintf(ptr->buf, MAXBUFSIZE-1, "set %s %d %ld %d \r\n", key, flags, expiry, valuelen);
|
||||
len = strlen(ptr->buf);
|
||||
|
||||
strncat(ptr->buf, value, MAXBUFSIZE-1);
|
||||
strncat(ptr->buf, "\r\n", MAXBUFSIZE-1);
|
||||
strncat(ptr->buf, value, MAXBUFSIZE-strlen(ptr->buf)-1);
|
||||
strncat(ptr->buf, "\r\n", MAXBUFSIZE-strlen(ptr->buf)-1);
|
||||
|
||||
len += valuelen + 2;
|
||||
|
||||
|
@ -467,7 +467,7 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata
|
||||
if(strncmp(buf, "Subject:", strlen("Subject:")) == 0) p += strlen("Subject:");
|
||||
if(*p == ' ') p++;
|
||||
|
||||
strncat(state->b_subject, p, MAXBUFSIZE-1);
|
||||
strncat(state->b_subject, p, MAXBUFSIZE-strlen(state->b_subject)-1);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -481,7 +481,7 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata
|
||||
while(isspace(*p)) p++;
|
||||
}
|
||||
|
||||
strncat(state->b_subject, p, MAXBUFSIZE-1);
|
||||
strncat(state->b_subject, p, MAXBUFSIZE-strlen(state->b_subject)-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,6 @@ static void takesig(int sig){
|
||||
break;
|
||||
|
||||
case SIGTERM:
|
||||
case SIGKILL:
|
||||
quit = 1;
|
||||
p_clean_exit();
|
||||
break;
|
||||
@ -246,10 +245,9 @@ void p_clean_exit(){
|
||||
if(data.dedup != MAP_FAILED) munmap(data.dedup, MAXCHILDREN*DIGEST_LENGTH*2);
|
||||
|
||||
#ifdef HAVE_STARTTLS
|
||||
if(data.ctx){
|
||||
SSL_CTX_free(data.ctx);
|
||||
ERR_free_strings();
|
||||
}
|
||||
if(data.ctx) SSL_CTX_free(data.ctx);
|
||||
|
||||
ERR_free_strings();
|
||||
#endif
|
||||
|
||||
exit(1);
|
||||
@ -463,7 +461,6 @@ int main(int argc, char **argv){
|
||||
|
||||
set_signal_handler(SIGCHLD, takesig);
|
||||
set_signal_handler(SIGTERM, takesig);
|
||||
set_signal_handler(SIGKILL, takesig);
|
||||
set_signal_handler(SIGHUP, takesig);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user