From 1a0e590851fcbf7e4d8299f619625c1d31754c03 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Tue, 29 Aug 2017 21:35:21 +0530 Subject: misc: fix warnings Change-Id: I11274ad59925ec3d034baefc2cc2e307afa45479 Signed-off-by: Prasanna Kumar Kalever --- utils/utils.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'utils') diff --git a/utils/utils.h b/utils/utils.h index 9bb9cc4..d3b1027 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -240,15 +240,12 @@ extern struct gbConf gbConf; char tmp[1024]; \ LOG("mgmt", GB_LOG_DEBUG, "command, %s", cmd); \ fp = popen(cmd, "r"); \ - if (vol) \ - snprintf(tmp, 1024, "%s/%s", vol, blk->block_name); \ - else \ - snprintf(tmp, 1024, "%s", blk->block_name); \ + snprintf(tmp, 1024, "%s/%s", vol?vol:"", blk->block_name); \ if (fp) { \ size_t newLen = fread(sr->out, sizeof(char), 8192, fp); \ if (ferror( fp ) != 0) \ LOG("mgmt", GB_LOG_ERROR, \ - "reading command %s output for %s failed", tmp, \ + "reading command %s output for %s failed(%s)", tmp,\ cmd, strerror(errno)); \ else \ sr->out[newLen++] = '\0'; \ @@ -265,15 +262,13 @@ extern struct gbConf gbConf; sr->exit); \ } while (0) -# define GB_OUT_VALIDATE_OR_GOTO(out, label, errStr, blk, vol, fmt ...)\ +# define GB_OUT_VALIDATE_OR_GOTO(out, label, errStr, blk, vol, ...) \ do { \ char *tmp; \ char vol_blk[1024]; \ - if (vol) \ - snprintf(vol_blk, 1024, "%s/%s", vol, blk->block_name); \ - else \ - snprintf(vol_blk, 1024, "%s", blk->block_name); \ - if (GB_ASPRINTF(&tmp, fmt) == -1) \ + snprintf(vol_blk, 1024, "%s/%s", vol?vol:"", \ + blk->block_name); \ + if (GB_ASPRINTF(&tmp, __VA_ARGS__) == -1) \ goto label; \ if (!strstr(out, tmp)) { \ GB_FREE(tmp); \ -- cgit