More checkpatch.pl happiness
This commit is contained in:
@@ -73,7 +73,8 @@ static void *servlet(void *args) /* Serve the connection -- threadable */
|
|||||||
/* TODO: Insert msg handler here */
|
/* TODO: Insert msg handler here */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (SSL_get_shutdown(agent->ssl) == SSL_RECEIVED_SHUTDOWN)
|
if (SSL_get_shutdown(agent->ssl)
|
||||||
|
== SSL_RECEIVED_SHUTDOWN)
|
||||||
log(VERBOSE,
|
log(VERBOSE,
|
||||||
"SSL_RECEIVED_SHUTDOWN from agent [%s]",
|
"SSL_RECEIVED_SHUTDOWN from agent [%s]",
|
||||||
agent->ip);
|
agent->ip);
|
||||||
@@ -84,7 +85,8 @@ static void *servlet(void *args) /* Serve the connection -- threadable */
|
|||||||
//log_ssl();
|
//log_ssl();
|
||||||
sprintf((char *)buf.chunk.data, "%s",
|
sprintf((char *)buf.chunk.data, "%s",
|
||||||
"Where's the data, m8?");
|
"Where's the data, m8?");
|
||||||
SSL_write(agent->ssl, &buf, sizeof(struct msg_t));
|
SSL_write(agent->ssl, &buf,
|
||||||
|
sizeof(struct msg_t));
|
||||||
}
|
}
|
||||||
log(INFO, "Agent [%s] disconnected.", agent->ip);
|
log(INFO, "Agent [%s] disconnected.", agent->ip);
|
||||||
} while (bytes);
|
} while (bytes);
|
||||||
@@ -111,7 +113,7 @@ void *agent_pool(void *args)
|
|||||||
pthread_t *agent_thread =
|
pthread_t *agent_thread =
|
||||||
(pthread_t *)malloc(pool->size * sizeof(pthread_t));
|
(pthread_t *)malloc(pool->size * sizeof(pthread_t));
|
||||||
struct agent_args *agent_struct =
|
struct agent_args *agent_struct =
|
||||||
(struct agent_args *)malloc(pool->size * sizeof(struct agent_args));
|
malloc(pool->size * sizeof(struct agent_args));
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(agent_thread, 0, sizeof(pthread_t) * pool->size);
|
memset(agent_thread, 0, sizeof(pthread_t) * pool->size);
|
||||||
|
|||||||
24
confparser.c
24
confparser.c
@@ -214,13 +214,15 @@ static int test_conf_syntax(void)
|
|||||||
while (fgets(buf, CFGLINESIZE, fp) != NULL) {
|
while (fgets(buf, CFGLINESIZE, fp) != NULL) {
|
||||||
j++;
|
j++;
|
||||||
/* kill comments and ignore BLANK lines */
|
/* kill comments and ignore BLANK lines */
|
||||||
if ((tmp = strstr(buf, "#")))
|
tmp = strstr(buf, "#");
|
||||||
|
if (tmp)
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
if (buf[strspn(buf, " \t\v\r\n")] == '\0')
|
if (buf[strspn(buf, " \t\v\r\n")] == '\0')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If we have "=", it's a possible var */
|
/* If we have "=", it's a possible var */
|
||||||
if ((tmp = strstr(buf, "=")))
|
tmp = strstr(buf, "=");
|
||||||
|
if (tmp)
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
else {
|
else {
|
||||||
log(ERROR,
|
log(ERROR,
|
||||||
@@ -258,8 +260,10 @@ static int test_conf_syntax(void)
|
|||||||
/* Just save it, launch_rmps will check it */
|
/* Just save it, launch_rmps will check it */
|
||||||
strcpy(conf.db.hostname, tmp + 1);
|
strcpy(conf.db.hostname, tmp + 1);
|
||||||
else if (!strcmp(buf, "db.port")) {
|
else if (!strcmp(buf, "db.port")) {
|
||||||
if ((i = strlen(tmp + 1)) < 6) {
|
i = strlen(tmp + 1);
|
||||||
if ((signed int)strspn(tmp + 1, "1234567890") == i) {
|
if (i < 6) { /* max 5 digits for network port */
|
||||||
|
if ((signed int)strspn(tmp + 1,
|
||||||
|
"1234567890") == i) {
|
||||||
i = atoi(tmp + 1);
|
i = atoi(tmp + 1);
|
||||||
if (i > 0 && i < 65536) {
|
if (i > 0 && i < 65536) {
|
||||||
strcpy(conf.db.port, tmp + 1);
|
strcpy(conf.db.port, tmp + 1);
|
||||||
@@ -274,8 +278,10 @@ static int test_conf_syntax(void)
|
|||||||
else if (!strcmp(buf, "rmps.agent_ip")) {
|
else if (!strcmp(buf, "rmps.agent_ip")) {
|
||||||
/* TODO */
|
/* TODO */
|
||||||
} else if (!strcmp(buf, "rmps.agent_port")) {
|
} else if (!strcmp(buf, "rmps.agent_port")) {
|
||||||
if ((i = strlen(tmp + 1)) < 6) {
|
i = strlen(tmp + 1);
|
||||||
if ((signed int)strspn(tmp + 1, "1234567890") == i) {
|
if (i < 6) { /* max 5 digits for network port */
|
||||||
|
if ((signed int)strspn(tmp + 1,
|
||||||
|
"1234567890") == i) {
|
||||||
i = atoi(tmp + 1);
|
i = atoi(tmp + 1);
|
||||||
if (i > 0 && i < 65536) {
|
if (i > 0 && i < 65536) {
|
||||||
strcpy(conf.rmps.agent_port,
|
strcpy(conf.rmps.agent_port,
|
||||||
@@ -289,8 +295,10 @@ static int test_conf_syntax(void)
|
|||||||
} else if (!strcmp(buf, "rmps.client_ip")) {
|
} else if (!strcmp(buf, "rmps.client_ip")) {
|
||||||
/* TODO */
|
/* TODO */
|
||||||
} else if (!strcmp(buf, "rmps.client_port")) {
|
} else if (!strcmp(buf, "rmps.client_port")) {
|
||||||
if ((i = strlen(tmp + 1)) < 6) {
|
i = strlen(tmp + 1);
|
||||||
if ((signed int)strspn(tmp + 1, "1234567890") == i) {
|
if (i < 6) { /* max 5 digits for network port */
|
||||||
|
if ((signed int)strspn(tmp + 1,
|
||||||
|
"1234567890") == i) {
|
||||||
i = atoi(tmp + 1);
|
i = atoi(tmp + 1);
|
||||||
if (i > 0 && i < 65536) {
|
if (i > 0 && i < 65536) {
|
||||||
strcpy(conf.rmps.client_port,
|
strcpy(conf.rmps.client_port,
|
||||||
|
|||||||
6
rmps.c
6
rmps.c
@@ -187,8 +187,7 @@ static int open_listener(int port)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (listen(sd, 10) != 0) {
|
if (listen(sd, 10) != 0) {
|
||||||
log(ERROR,
|
log(ERROR, "Failed to start listener on port %d - Aborting...",
|
||||||
"Failed to start listener on port %d - Aborting...",
|
|
||||||
port);
|
port);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -307,7 +306,8 @@ void launch_rmps(struct conf_table *conf, int fork_flag)
|
|||||||
log(VERBOSE, "Creating client thread pool (mutex).");
|
log(VERBOSE, "Creating client thread pool (mutex).");
|
||||||
pthread_create(&pool[1], NULL, client_pool, &pool_args[1]);
|
pthread_create(&pool[1], NULL, client_pool, &pool_args[1]);
|
||||||
if (start_job_queue(conf->rmps.agent_poolsize) == FAIL) {
|
if (start_job_queue(conf->rmps.agent_poolsize) == FAIL) {
|
||||||
log(ERROR, "On start_job_queue(), RMPS failed to start, shutting down...");
|
log(ERROR,
|
||||||
|
"On start_job_queue(), RMPS failed to start, shutting down...");
|
||||||
atexit(cleanup);
|
atexit(cleanup);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user