[Gluster-devel] [PATCH 1/2] glusterfsd: fix two GCC warnings on format string

Liu Yuan namei.unix at gmail.com
Tue Nov 13 11:39:11 UTC 2012


From: Liu Yuan <tailai.ly at taobao.com>

With GCC 4.6.3, following warning is reported

warning: format not a string literal and no format arguments [-Wformat-security]

In function 'glusterd_op_set_volume' and 'glusterd_op_stage_replace_brick'.

This patch adds "%s" explicitly to these two call site of gf_log().

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 xlators/mgmt/glusterd/src/glusterd-op-sm.c         |    2 +-
 xlators/mgmt/glusterd/src/glusterd-replace-brick.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 40f38f5..a269d2d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1165,7 +1165,7 @@ glusterd_op_set_volume (dict_t *dict)
                 if (ret) {
                         op_errstr = (op_errstr)? op_errstr:
                                      "Volume set help internal error";
-                        gf_log (this->name, GF_LOG_ERROR, op_errstr);
+                        gf_log (this->name, GF_LOG_ERROR, "%s", op_errstr);
                 }
                 goto out;
          }
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index edc2627..0ca8da6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -432,7 +432,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
         if (ret) {
                 *op_errstr = gf_strdup (msg);
                 ret = -1;
-                gf_log (THIS->name, GF_LOG_ERROR, *op_errstr);
+                gf_log (THIS->name, GF_LOG_ERROR, "%s", *op_errstr);
                 goto out;
         }
 
-- 
1.7.9.5





More information about the Gluster-devel mailing list