Skip to content

Commit

Permalink
Fixing space/tab inconsistencies
Browse files Browse the repository at this point in the history
Change-Id: Ia4a3a9fdd4c7db0de03f72703a5032081b666728
  • Loading branch information
ottomata committed Feb 18, 2014
1 parent 90ffb68 commit 7516d64
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ int kt_popen (const char *cmdstring, const char *rw,
}

/* Execute command */
execl("/bin/sh", "sh", "-c", cmdstring, NULL);
_exit(127);
execl("/bin/sh", "sh", "-c", cmdstring, NULL);
_exit(127);
}


Expand Down Expand Up @@ -273,8 +273,8 @@ static void *exec_main (void *ignore) {
struct child_proc *cp;

/* Install SIGCHLD handler to reap dying child processes */
ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);
ezd_thread_sigmask(SIG_UNBLOCK, SIGCHLD, -1/*end*/);
ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);
ezd_thread_sigmask(SIG_UNBLOCK, SIGCHLD, -1/*end*/);
signal(SIGCHLD, sigchld);

while (conf.run || child_proc_cnt > 0) {
Expand Down
2 changes: 1 addition & 1 deletion ezd.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ int ezd_conf_file_read (const char *path,
"Failed to read include file pattern '%s'", t);
inc_depth--;
return -1;
}
}

/* For each matched include file, call ezd_conf_file_read. */
for (g = 0; g < glob_matches.gl_pathc; g++) {
Expand Down
6 changes: 3 additions & 3 deletions format.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static int jp_bool (void *opaque, int val) {


static int jp_number (void *opaque, const char *numval,
YAJL_SIZE_TYPE numlen) {
YAJL_SIZE_TYPE numlen) {
struct json_parse_ctx *jp = opaque;

_JP_CHECK();
Expand All @@ -307,7 +307,7 @@ static int jp_number (void *opaque, const char *numval,


static int jp_string (void *opaque, const unsigned char *val,
YAJL_SIZE_TYPE len) {
YAJL_SIZE_TYPE len) {
struct json_parse_ctx *jp = opaque;

_JP_CHECK();
Expand All @@ -323,7 +323,7 @@ static int jp_start_map (void *opaque) {


static int jp_map_key (void *opaque, const unsigned char *key,
YAJL_SIZE_TYPE len) {
YAJL_SIZE_TYPE len) {
struct json_parse_ctx *jp = opaque;
const struct fmtvar *fmtvar;

Expand Down
8 changes: 4 additions & 4 deletions input.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void input_pipe_main (input_t *in) {
int status; /* pipe exit status */
char errstr[512];
char *buf;
static int our_rotate_version = 0;
static int our_rotate_version = 0;

buf = malloc(conf.input_buf_size);

Expand Down Expand Up @@ -167,9 +167,9 @@ static void input_pipe_main (input_t *in) {
}

if (unlikely(conf.rotate != our_rotate_version)) {
our_rotate_version = conf.rotate;
our_rotate_version = conf.rotate;
break;
}
}
}

_DBG("Input \"%s\" Status=%i, EOF=%i, Error=%i", in->in_name,
Expand Down Expand Up @@ -293,7 +293,7 @@ static void input_kafka_main (input_t *in) {
static void *input_main (void *arg) {
input_t *in = arg;

ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);
ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);

switch (in->in_type)
{
Expand Down
70 changes: 35 additions & 35 deletions kafkatee.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "ezd.h"

static void sighup (int sig) {
static int rotate_version = 0;
static int rotate_version = 0;
conf.rotate = ++rotate_version;
}

Expand Down Expand Up @@ -74,40 +74,40 @@ static void kafka_error_cb (rd_kafka_t *rk, int err,
* Kafka statistics callback.
*/
static int kafka_stats_cb (rd_kafka_t *rk, char *json, size_t json_len,
void *opaque) {
if (!conf.stats_fp)
return 0;
void *opaque) {
if (!conf.stats_fp)
return 0;

fprintf(conf.stats_fp, "{ \"kafka\": %s }\n", json);
fprintf(conf.stats_fp, "{ \"kafka\": %s }\n", json);
return 0;
}

/**
* Output kafkatee specific stats to statsfile.
*/
static void stats_print (void) {
/* FIXME: Currently none */
/* FIXME: Currently none */
}

static void stats_close (void) {
stats_print();
fclose(conf.stats_fp);
conf.stats_fp = NULL;
stats_print();
fclose(conf.stats_fp);
conf.stats_fp = NULL;
}

static int stats_open (void) {
/* Already open? close and then reopen */
if (conf.stats_fp)
stats_close();

if (!(conf.stats_fp = fopen(conf.stats_file, "a"))) {
kt_log(LOG_ERR,
"Failed to open statistics log file %s: %s",
conf.stats_file, strerror(errno));
return -1;
}

return 0;
/* Already open? close and then reopen */
if (conf.stats_fp)
stats_close();

if (!(conf.stats_fp = fopen(conf.stats_file, "a"))) {
kt_log(LOG_ERR,
"Failed to open statistics log file %s: %s",
conf.stats_file, strerror(errno));
return -1;
}

return 0;
}


Expand Down Expand Up @@ -142,7 +142,7 @@ int main (int argc, char **argv) {
char errstr[512];
char c;
int r;
static int our_rotate_version = 0;
static int our_rotate_version = 0;

/*
* Default configuration
Expand Down Expand Up @@ -245,7 +245,7 @@ int main (int argc, char **argv) {
if (conf.stats_interval) {
char tmp[30];

if (stats_open() == -1) {
if (stats_open() == -1) {
fprintf(stderr,
"Failed to open statistics log file %s: %s\n",
conf.stats_file, strerror(errno));
Expand Down Expand Up @@ -287,30 +287,30 @@ int main (int argc, char **argv) {
"with exit code %i", conf.cmd_init, r);
}

/* Block all signals in the main thread so new threads get the same
* procmask. */
ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);
/* Block all signals in the main thread so new threads get the same
* procmask. */
ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);

/* Start IO */
outputs_start();
inputs_start();


/* Set main thread sigmask */
ezd_thread_sigmask(SIG_UNBLOCK, SIGHUP, SIGINT, SIGTERM, -1);
/* Set main thread sigmask */
ezd_thread_sigmask(SIG_UNBLOCK, SIGHUP, SIGINT, SIGTERM, -1);
signal(SIGHUP, sighup);
signal(SIGINT, term);
signal(SIGTERM, term);

/* Main loop */
while (conf.run) {
rd_kafka_poll(conf.rk, 1000);
if (unlikely(conf.rotate != our_rotate_version)) {
our_rotate_version = conf.rotate;
if (conf.stats_interval)
stats_open();
}
}
if (unlikely(conf.rotate != our_rotate_version)) {
our_rotate_version = conf.rotate;
if (conf.stats_interval)
stats_open();
}
}

inputs_term();
outputs_term();
Expand All @@ -321,7 +321,7 @@ int main (int argc, char **argv) {

/* if stats_fp is set (i.e. open), close it. */
if (conf.stats_fp)
stats_close();
stats_close();
free(conf.stats_file);

/* Run termination command, if any. */
Expand Down
18 changes: 9 additions & 9 deletions output.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ static void outputs_check (void) {

/* Already open */
if (o->o_fd != -1) {
if (o->o_type == OUTPUT_PIPE &&
o->o_pipe.status != -1)
output_close(o, LOG_WARNING,
exec_exitstatus(o->o_pipe.status));
continue;
if (o->o_type == OUTPUT_PIPE &&
o->o_pipe.status != -1)
output_close(o, LOG_WARNING,
exec_exitstatus(o->o_pipe.status));
continue;
}

/* Last open failed: back off */
Expand Down Expand Up @@ -414,10 +414,10 @@ static void *outputs_main (void *ignore) {
struct epoll_event *ev;
time_t t_last_check = 0;
output_t *o;
static int our_rotate_version = 0;
static int our_rotate_version = 0;

/* Block all signals in this thread */
ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);
/* Block all signals in this thread */
ezd_thread_sigmask(SIG_BLOCK, 0/*ALL*/, -1/*end*/);

ev = malloc(sizeof(*ev) * outputs_cnt);

Expand All @@ -428,7 +428,7 @@ static void *outputs_main (void *ignore) {

if (unlikely(conf.rotate != our_rotate_version)) {
/* Outputs rotation */
our_rotate_version = conf.rotate;
our_rotate_version = conf.rotate;
outputs_rotate();
} else {
/* Periodic outputs checker */
Expand Down

0 comments on commit 7516d64

Please sign in to comment.