From e3d7efda7fe99f20af22e01b31ee619d223920fb Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Fri, 6 Nov 2015 11:33:05 +0800 Subject: [PATCH] Add CRYPT mode to buffer when doing a set-encryption-key on a buffer where the mode is not set yet. --- file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/file.c b/file.c index 1bf8757..dff4c8c 100644 --- a/file.c +++ b/file.c @@ -19,6 +19,7 @@ #include "buffer.h" #include "crypt.h" #include "defines.h" +#include "display.h" #include "estruct.h" #include "execute.h" #include "fileio.h" @@ -205,6 +206,10 @@ int set_encryption_key( int f, int n) { curbp->b_key[ sizeof( ekey_t) - 1] = '\0' ; free( key) ; cryptbufferkey( curbp) ; + if( !(curbp->b_mode & MDCRYPT)) { + curbp->b_mode |= MDCRYPT ; + upmode() ; + } mloutstr( "") ; /* clear the message line */ return TRUE ;