summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-02-27 18:22:24 +0100
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-02-27 18:22:24 +0100
commit9a40ab3afe2f6111c0741468a095eec419be5e53 (patch)
tree47389e3b7900d56d4fdd8549c83114d74c079579
parent4b242f9a49958466d7131c8e3233cbe408a7e2e0 (diff)
downloadceph-9a40ab3afe2f6111c0741468a095eec419be5e53.tar.gz
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 <danny.al-gaaf@bisect.de>
-rw-r--r--src/common/secret.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/secret.c b/src/common/secret.c
index f37619a72da..82150930eab 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;