[Pacemaker] [PATCH 2/8] cl_log: Simplify a function

Bernd Schubert bs_lists at aakef.fastmail.fm
Wed Sep 15 18:12:26 EDT 2010


cl_log: Simplify a function

Signed-off-by: Bernd Schubert <bschubert at ddn.com>

diff --git a/lib/clplumbing/cl_log.c b/lib/clplumbing/cl_log.c
--- a/lib/clplumbing/cl_log.c
+++ b/lib/clplumbing/cl_log.c
@@ -545,7 +545,7 @@ cl_direct_log(int priority, const char* 
 		entity =cl_log_entity;
 	}
 	
-	pristr = use_priority_str ? prio2str(priority) : NULL;
+	pristr = use_priority_str ? prio2str(priority) : "";
 
 	if (needprivs) {
 		return_to_orig_privs();
@@ -555,17 +555,13 @@ cl_direct_log(int priority, const char* 
 		if (entity) {
 			strncpy(common_log_entity, entity, MAXENTITY);
 		} else {
-			strncpy(common_log_entity, DFLT_ENTITY,MAXENTITY);
+			strncpy(common_log_entity, DFLT_ENTITY, MAXENTITY);
 		}
 
 		common_log_entity[MAXENTITY-1] = '\0';
 
-		if (pristr) {
-			syslog(priority, "[%d]: %s: %s%c",
-			       entity_pid, pristr,  buf, 0);
-		}else {
-			syslog(priority, "[%d]: %s%c", entity_pid, buf, 0);
-		}
+		syslog(priority, "[%d]: %s: %s%c",
+		       entity_pid, pristr,  buf, 0);
 	}
 
 	if (debugfile_name != NULL) {




More information about the Pacemaker mailing list