On Fri, Nov 12, 2010 at 05:04:39PM +0100, [email protected] wrote:
> # HG changeset patch
> # User Bernd Schubert <[email protected]>
> # Date 1289577717 -3600
> # Node ID 39cc45ad8013fbf725254974070407fee2e1027b
> # Parent  ad13ee71cc6672092b13a73e89c7b0894faa5146
> cl_log: Simplify a function
> 
> Signed-off-by: Bernd Schubert <[email protected]>
> 
> 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
> @@ -534,7 +534,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();
> @@ -544,17 +544,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);

This leaves an ugly colon.  "[1234]: : message here"
Why?
What's wrong with an extra test on NULL
for the use_priority_str == 0 case?

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to