HomeClusterLabs Projects

Fix: ocf_exit_reason: implicit format string "%s" for single argument version

Description

Fix: ocf_exit_reason: implicit format string "%s" for single argument version

Also, don't use the $msg as format string, but via "%s%s" "$cookie" "$msg".
Or, depending on presence of % sequences in $msg,
you'd get different output on stderr and via ha_log.

Without the patch:

( OCF_ROOT=$PWD dash -c '. heartbeat/ocf-shellfuncs.in ; ocf_exit_reason "0.x% Bugs less"' )
dash: 372: printf: % B: invalid directive
ocf-exit-reason:0.x
( OCF_ROOT=$PWD dash -c '. heartbeat/ocf-shellfuncs.in ; ocf_exit_reason "0.x% bugs less"' )
ocf-exit-reason:0.xugs less

With this patch:

( OCF_ROOT=$PWD dash -c '. heartbeat/ocf-shellfuncs.in ; ocf_exit_reason "0.x% Bugs less"' )
ocf-exit-reason:0.x% Bugs less
( OCF_ROOT=$PWD dash -c '. heartbeat/ocf-shellfuncs.in ; ocf_exit_reason "0.x% bugs less"' )
ocf-exit-reason:0.x% bugs less

Details

Provenance
Lars Ellenberg <lars.ellenberg@linbit.com>Authored on Sep 22 2014, 8:58 AM
Parents
rRd5558f032a96: Merge pull request #502 from davidvossel/master
Branches
Unknown
Tags
Unknown

Event Timeline