diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-08-29 21:35:21 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-08-29 23:00:13 +0530 |
commit | 1a0e590851fcbf7e4d8299f619625c1d31754c03 (patch) | |
tree | 7b3a8c1ea7704e1e1d904bf7833eecd2aef4b785 /utils | |
parent | 64ba10f39774607b32e1f71b2852d4f34fde378f (diff) |
misc: fix warnings
Change-Id: I11274ad59925ec3d034baefc2cc2e307afa45479
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utils.h | 17 |
1 files changed, 6 insertions, 11 deletions
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); \ |