Add CRYPT mode to buffer when doing a set-encryption-key on a buffer where the mode is not set yet.

This commit is contained in:
Renaud 2015-11-06 11:33:05 +08:00
parent 8aeb526a2a
commit e3d7efda7f
1 changed files with 5 additions and 0 deletions

5
file.c
View File

@ -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 ;