The PAD and PRINT macros are multi-line macros that aren't enclosed in braces. This means that if they are used as single line code blocks with no braces, they won't work correctly. This is currently happening with the PAD macro, but should be fixed in both. Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> --- libmultipath/print.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libmultipath/print.c b/libmultipath/print.c index 6215d0b..13d076a 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -32,14 +32,21 @@ #define MAX(x,y) (x > y) ? x : y #define TAIL (line + len - 1 - c) #define NOPAD s = c -#define PAD(x) while ((int)(c - s) < (x) && (c < (line + len - 1))) \ - *c++ = ' '; s = c +#define PAD(x) \ +do { \ + while ((int)(c - s) < (x) && (c < (line + len - 1))) \ + *c++ = ' '; \ + s = c; \ +} while (0) + #define ENDLINE \ if (c > line) \ line[c - line - 1] = '\n' -#define PRINT(var, size, format, args...) \ - fwd = snprintf(var, size, format, ##args); \ - c += (fwd >= size) ? size : fwd; +#define PRINT(var, size, format, args...) \ +do { \ + fwd = snprintf(var, size, format, ##args); \ + c += (fwd >= size) ? size : fwd; \ +} while (0) /* * information printing helpers -- 1.8.3.1 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel