Skip to content

Commit

Permalink
Remove newlines from log_message calls.
Browse files Browse the repository at this point in the history
Patch from Ryan O'Hara <rohara <at> redhat <dot> com>:
A newline will be added to the message in the log_message if console
logging is enabled, else the newline is not necessary. This patch
removes all newlines from log_message calls to avoid double newlines
when logging to stderr.

I rebased it manually
  • Loading branch information
acassen committed Jul 26, 2012
1 parent 860a4c9 commit 65e98be
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion keepalived/check/check_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ init_ssl_ctx(void)
log_message(LOG_INFO, " SSL keyfile:%s", ssl->keyfile);
log_message(LOG_INFO, " SSL password:%s", ssl->password);
log_message(LOG_INFO, " SSL cafile:%s", ssl->cafile);
log_message(LOG_INFO, "Terminate...\n");
log_message(LOG_INFO, "Terminate...");
clear_ssl(ssl);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion keepalived/check/ipwrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ clear_diff_vsge(list old, list new, virtual_server * old_vs)
for (e = LIST_HEAD(old); e; ELEMENT_NEXT(e)) {
vsge = ELEMENT_DATA(e);
if (!vsge_exist(vsge, new)) {
log_message(LOG_INFO, "VS [[%s]:%d:%d:%d] in group %s no longer exist\n"
log_message(LOG_INFO, "VS [[%s]:%d:%d:%d] in group %s no longer exist"
, inet_sockaddrtos(&vsge->addr)
, ntohs(inet_sockaddrport(&vsge->addr))
, vsge->range
Expand Down
22 changes: 11 additions & 11 deletions keepalived/vrrp/vrrp_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ vrrp_vrid_handler(vector strvec)
vrrp->vrid = atoi(VECTOR_SLOT(strvec, 1));

if (VRRP_IS_BAD_VID(vrrp->vrid)) {
log_message(LOG_INFO, "VRRP Error : VRID not valid !\n");
log_message(LOG_INFO, "VRRP Error : VRID not valid !");
log_message(LOG_INFO,
" must be between 1 & 255. reconfigure !\n");
" must be between 1 & 255. reconfigure !");
} else {
alloc_vrrp_bucket(vrrp);
if (vrrp->vmac && strlen(vrrp->vmac_ifname) == 0) {
Expand All @@ -212,9 +212,9 @@ vrrp_prio_handler(vector strvec)
vrrp->effective_priority = vrrp->base_priority = atoi(VECTOR_SLOT(strvec, 1));

if (VRRP_IS_BAD_PRIORITY(vrrp->base_priority)) {
log_message(LOG_INFO, "VRRP Error : Priority not valid !\n");
log_message(LOG_INFO, "VRRP Error : Priority not valid !");
log_message(LOG_INFO,
" must be between 1 & 255. reconfigure !\n");
" must be between 1 & 255. reconfigure !");
log_message(LOG_INFO,
" Using default value : %d\n", VRRP_PRIO_DFL);
vrrp->effective_priority = vrrp->base_priority = VRRP_PRIO_DFL;
Expand All @@ -227,10 +227,10 @@ vrrp_adv_handler(vector strvec)
vrrp->adver_int = atoi(VECTOR_SLOT(strvec, 1));

if (VRRP_IS_BAD_ADVERT_INT(vrrp->adver_int)) {
log_message(LOG_INFO, "VRRP Error : Advert interval not valid !\n");
log_message(LOG_INFO, "VRRP Error : Advert interval not valid !");
log_message(LOG_INFO,
" must be between less than 1sec.\n");
log_message(LOG_INFO, " Using default value : 1sec\n");
" must be between less than 1sec.");
log_message(LOG_INFO, " Using default value : 1sec");
vrrp->adver_int = 1;
}
vrrp->adver_int *= TIMER_HZ;
Expand All @@ -242,8 +242,8 @@ vrrp_debug_handler(vector strvec)
vrrp->debug = atoi(VECTOR_SLOT(strvec, 1));

if (VRRP_IS_BAD_DEBUG_INT(vrrp->debug)) {
log_message(LOG_INFO, "VRRP Error : Debug interval not valid !\n");
log_message(LOG_INFO, " must be between 0-4\n");
log_message(LOG_INFO, "VRRP Error : Debug interval not valid !");
log_message(LOG_INFO, " must be between 0-4");
vrrp->debug = 0;
}
}
Expand All @@ -266,8 +266,8 @@ vrrp_preempt_delay_handler(vector strvec)
vrrp->preempt_delay = atoi(VECTOR_SLOT(strvec, 1));

if (VRRP_IS_BAD_PREEMPT_DELAY(vrrp->preempt_delay)) {
log_message(LOG_INFO, "VRRP Error : Preempt_delay not valid !\n");
log_message(LOG_INFO, " must be between 0-%d\n",
log_message(LOG_INFO, "VRRP Error : Preempt_delay not valid !");
log_message(LOG_INFO, " must be between 0-%d",
TIMER_MAX_SEC);
vrrp->preempt_delay = 0;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ void read_conf_file(char *conf_file)

int i;
for(i = 0; i < globbuf.gl_pathc; i++){
log_message(LOG_INFO, "Opening file '%s'.\n", globbuf.gl_pathv[i]);
log_message(LOG_INFO, "Opening file '%s'.", globbuf.gl_pathv[i]);
stream = fopen(globbuf.gl_pathv[i], "r");
if (!stream) {
log_message(LOG_INFO, "Configuration file '%s' open problem (%s)...\n"
log_message(LOG_INFO, "Configuration file '%s' open problem (%s)..."
, globbuf.gl_pathv[i], strerror(errno));
return;
}
Expand All @@ -212,23 +212,23 @@ void read_conf_file(char *conf_file)
char prev_path[MAXBUF];
path = getcwd(prev_path, MAXBUF);
if (!path) {
log_message(LOG_INFO, "getcwd(%s) error (%s)\n"
log_message(LOG_INFO, "getcwd(%s) error (%s)"
, prev_path, strerror(errno));
}

char *confpath = strdup(globbuf.gl_pathv[i]);
dirname(confpath);
ret = chdir(confpath);
if (ret < 0) {
log_message(LOG_INFO, "chdir(%s) error (%s)\n"
log_message(LOG_INFO, "chdir(%s) error (%s)"
, confpath, strerror(errno));
}
process_stream(current_keywords);
fclose(stream);

ret = chdir(prev_path);
if (ret < 0) {
log_message(LOG_INFO, "chdir(%s) error (%s)\n"
log_message(LOG_INFO, "chdir(%s) error (%s)"
, prev_path, strerror(errno));
}
}
Expand Down

0 comments on commit 65e98be

Please sign in to comment.