More checkpatch.pl happiness

This commit is contained in:
2017-06-21 11:52:34 +03:00
parent caa0e2b6a7
commit a0915fc803
3 changed files with 24 additions and 14 deletions

View File

@@ -73,7 +73,8 @@ static void *servlet(void *args) /* Serve the connection -- threadable */
/* TODO: Insert msg handler here */
continue;
}
if (SSL_get_shutdown(agent->ssl) == SSL_RECEIVED_SHUTDOWN)
if (SSL_get_shutdown(agent->ssl)
== SSL_RECEIVED_SHUTDOWN)
log(VERBOSE,
"SSL_RECEIVED_SHUTDOWN from agent [%s]",
agent->ip);
@@ -84,7 +85,8 @@ static void *servlet(void *args) /* Serve the connection -- threadable */
//log_ssl();
sprintf((char *)buf.chunk.data, "%s",
"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);
} while (bytes);
@@ -111,7 +113,7 @@ void *agent_pool(void *args)
pthread_t *agent_thread =
(pthread_t *)malloc(pool->size * sizeof(pthread_t));
struct agent_args *agent_struct =
(struct agent_args *)malloc(pool->size * sizeof(struct agent_args));
malloc(pool->size * sizeof(struct agent_args));
int i;
memset(agent_thread, 0, sizeof(pthread_t) * pool->size);

View File

@@ -214,13 +214,15 @@ static int test_conf_syntax(void)
while (fgets(buf, CFGLINESIZE, fp) != NULL) {
j++;
/* kill comments and ignore BLANK lines */
if ((tmp = strstr(buf, "#")))
tmp = strstr(buf, "#");
if (tmp)
*tmp = '\0';
if (buf[strspn(buf, " \t\v\r\n")] == '\0')
continue;
/* If we have "=", it's a possible var */
if ((tmp = strstr(buf, "=")))
tmp = strstr(buf, "=");
if (tmp)
*tmp = '\0';
else {
log(ERROR,
@@ -258,8 +260,10 @@ static int test_conf_syntax(void)
/* Just save it, launch_rmps will check it */
strcpy(conf.db.hostname, tmp + 1);
else if (!strcmp(buf, "db.port")) {
if ((i = strlen(tmp + 1)) < 6) {
if ((signed int)strspn(tmp + 1, "1234567890") == i) {
i = strlen(tmp + 1);
if (i < 6) { /* max 5 digits for network port */
if ((signed int)strspn(tmp + 1,
"1234567890") == i) {
i = atoi(tmp + 1);
if (i > 0 && i < 65536) {
strcpy(conf.db.port, tmp + 1);
@@ -274,8 +278,10 @@ static int test_conf_syntax(void)
else if (!strcmp(buf, "rmps.agent_ip")) {
/* TODO */
} else if (!strcmp(buf, "rmps.agent_port")) {
if ((i = strlen(tmp + 1)) < 6) {
if ((signed int)strspn(tmp + 1, "1234567890") == i) {
i = strlen(tmp + 1);
if (i < 6) { /* max 5 digits for network port */
if ((signed int)strspn(tmp + 1,
"1234567890") == i) {
i = atoi(tmp + 1);
if (i > 0 && i < 65536) {
strcpy(conf.rmps.agent_port,
@@ -289,8 +295,10 @@ static int test_conf_syntax(void)
} else if (!strcmp(buf, "rmps.client_ip")) {
/* TODO */
} else if (!strcmp(buf, "rmps.client_port")) {
if ((i = strlen(tmp + 1)) < 6) {
if ((signed int)strspn(tmp + 1, "1234567890") == i) {
i = strlen(tmp + 1);
if (i < 6) { /* max 5 digits for network port */
if ((signed int)strspn(tmp + 1,
"1234567890") == i) {
i = atoi(tmp + 1);
if (i > 0 && i < 65536) {
strcpy(conf.rmps.client_port,

6
rmps.c
View File

@@ -187,8 +187,7 @@ static int open_listener(int port)
goto exit;
}
if (listen(sd, 10) != 0) {
log(ERROR,
"Failed to start listener on port %d - Aborting...",
log(ERROR, "Failed to start listener on port %d - Aborting...",
port);
goto exit;
}
@@ -307,7 +306,8 @@ void launch_rmps(struct conf_table *conf, int fork_flag)
log(VERBOSE, "Creating client thread pool (mutex).");
pthread_create(&pool[1], NULL, client_pool, &pool_args[1]);
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);
return;
}