summaryrefslogtreecommitdiff
path: root/sql/mf_iocache_encr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/mf_iocache_encr.cc')
-rw-r--r--sql/mf_iocache_encr.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index 96658e2e3d0..ae314d826a0 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -230,7 +230,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
Note that encrypt_tmp_files variable is read-only.
*/
-void init_io_cache_encryption()
+int init_io_cache_encryption()
{
if (encrypt_tmp_files)
{
@@ -241,20 +241,23 @@ void init_io_cache_encryption()
keyid= ENCRYPTION_KEY_SYSTEM_DATA;
keyver= encryption_key_get_latest_version(keyid);
}
- }
- else
- keyver= ENCRYPTION_KEY_VERSION_INVALID;
+ if (keyver == ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ sql_print_error("Failed to enable encryption of temporary files");
+ return 1;
+ }
- if (keyver != ENCRYPTION_KEY_VERSION_INVALID)
- {
- sql_print_information("Using encryption key id %d for temporary files", keyid);
- _my_b_encr_read= my_b_encr_read;
- _my_b_encr_write= my_b_encr_write;
- }
- else
- {
- _my_b_encr_read= 0;
- _my_b_encr_write= 0;
+ if (keyver != ENCRYPTION_KEY_NOT_ENCRYPTED)
+ {
+ sql_print_information("Using encryption key id %d for temporary files", keyid);
+ _my_b_encr_read= my_b_encr_read;
+ _my_b_encr_write= my_b_encr_write;
+ return 0;
+ }
}
+
+ _my_b_encr_read= 0;
+ _my_b_encr_write= 0;
+ return 0;
}