From: Danny Al-Gaaf Date: Wed, 27 Feb 2013 17:22:24 +0000 (+0100) Subject: common/secret.c: reduce the scope of some variables X-Git-Tag: v0.59~84^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a40ab3afe2f6111c0741468a095eec419be5e53;p=ceph.git common/secret.c: reduce the scope of some variables Reduce the scope of error_buf to the place where it's used. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/common/secret.c b/src/common/secret.c index f37619a72dad..82150930eabe 100644 --- a/src/common/secret.c +++ b/src/common/secret.c @@ -57,7 +57,6 @@ int set_kernel_secret(const char *secret, const char *key_name) int ret; int secret_len = strlen(secret); char payload[((secret_len * 3) / 4) + 4]; - char error_buf[80]; if (!secret_len) { fprintf(stderr, "secret is empty.\n"); @@ -66,6 +65,7 @@ int set_kernel_secret(const char *secret, const char *key_name) ret = ceph_unarmor(payload, payload+sizeof(payload), secret, secret+secret_len); if (ret < 0) { + char error_buf[80]; fprintf(stderr, "secret is not valid base64: %s.\n", strerror_r(-ret, error_buf, sizeof(error_buf))); return ret; @@ -99,7 +99,6 @@ int get_secret_option(const char *secret, const char *key_name, olen += strlen(secret); } char option[olen+1]; - char error_buf[80]; int use_key = 1; option[olen] = '\0'; @@ -114,6 +113,7 @@ int get_secret_option(const char *secret, const char *key_name, ret = 0; use_key = 0; } else { + char error_buf[80]; fprintf(stderr, "adding ceph secret key to kernel failed: %s.\n", strerror_r(-ret, error_buf, sizeof(error_buf))); return ret;