mirror of
https://github.com/vgough/encfs.git
synced 2025-06-20 11:47:58 +02:00
fix compiler warnings about unused fgets calls
git-svn-id: http://encfs.googlecode.com/svn/trunk@56 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
parent
47e0c24182
commit
ec01fad129
@ -315,9 +315,9 @@ bool userAllowMkdir( const char *path, mode_t mode )
|
|||||||
// xgroup(setup)
|
// xgroup(setup)
|
||||||
cerr << autosprintf( _("The directory \"%s\" does not exist. Should it be created? (y,n) "), path );
|
cerr << autosprintf( _("The directory \"%s\" does not exist. Should it be created? (y,n) "), path );
|
||||||
char answer[10];
|
char answer[10];
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
|
|
||||||
if(toupper(answer[0]) == 'Y')
|
if(res != 0 && toupper(answer[0]) == 'Y')
|
||||||
{
|
{
|
||||||
int result = mkdir( path, mode );
|
int result = mkdir( path, mode );
|
||||||
if(result < 0)
|
if(result < 0)
|
||||||
@ -675,8 +675,8 @@ Cipher::CipherAlgorithm selectCipherAlgorithm()
|
|||||||
// xgroup(setup)
|
// xgroup(setup)
|
||||||
cout << "\n" << _("Enter the number corresponding to your choice: ");
|
cout << "\n" << _("Enter the number corresponding to your choice: ");
|
||||||
char answer[10];
|
char answer[10];
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
int cipherNum = atoi( answer );
|
int cipherNum = (res == 0 ? 0 : atoi( answer ));
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
|
||||||
if( cipherNum < 1 || cipherNum > (int)algorithms.size() )
|
if( cipherNum < 1 || cipherNum > (int)algorithms.size() )
|
||||||
@ -720,8 +720,8 @@ Interface selectNameCoding()
|
|||||||
// xgroup(setup)
|
// xgroup(setup)
|
||||||
cout << "\n" << _("Enter the number corresponding to your choice: ");
|
cout << "\n" << _("Enter the number corresponding to your choice: ");
|
||||||
char answer[10];
|
char answer[10];
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
int algNum = atoi( answer );
|
int algNum = (res == 0 ? 0 : atoi( answer ));
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
|
||||||
if( algNum < 1 || algNum > (int)algorithms.size() )
|
if( algNum < 1 || algNum > (int)algorithms.size() )
|
||||||
@ -787,8 +787,8 @@ int selectKeySize( const Cipher::CipherAlgorithm &alg )
|
|||||||
cout << "\n" << _("Selected key size: ");
|
cout << "\n" << _("Selected key size: ");
|
||||||
|
|
||||||
char answer[10];
|
char answer[10];
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
int keySize = atoi( answer );
|
int keySize = (res == 0 ? 0 : atoi( answer ));
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
|
||||||
keySize = alg.keyLength.closest( keySize );
|
keySize = alg.keyLength.closest( keySize );
|
||||||
@ -824,10 +824,10 @@ int selectBlockSize( const Cipher::CipherAlgorithm &alg )
|
|||||||
|
|
||||||
int blockSize = DefaultBlockSize;
|
int blockSize = DefaultBlockSize;
|
||||||
char answer[10];
|
char answer[10];
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
|
||||||
if( atoi( answer ) >= alg.blockSize.min() )
|
if( res != 0 && atoi( answer ) >= alg.blockSize.min() )
|
||||||
blockSize = atoi( answer );
|
blockSize = atoi( answer );
|
||||||
|
|
||||||
blockSize = alg.blockSize.closest( blockSize );
|
blockSize = alg.blockSize.closest( blockSize );
|
||||||
@ -847,10 +847,10 @@ bool boolDefaultNo(const char *prompt)
|
|||||||
"Any response that does not begin with 'y' will mean No: ");
|
"Any response that does not begin with 'y' will mean No: ");
|
||||||
|
|
||||||
char answer[10];
|
char answer[10];
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
|
||||||
if(tolower(answer[0]) == 'y')
|
if(res != 0 && tolower(answer[0]) == 'y')
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -882,10 +882,10 @@ void selectBlockMAC(int *macBytes, int *macRandBytes)
|
|||||||
|
|
||||||
char answer[10];
|
char answer[10];
|
||||||
int randSize = 0;
|
int randSize = 0;
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
|
||||||
randSize = atoi( answer );
|
randSize = (res == 0 ? 0 : atoi( answer ));
|
||||||
if(randSize < 0)
|
if(randSize < 0)
|
||||||
randSize = 0;
|
randSize = 0;
|
||||||
if(randSize > 8)
|
if(randSize > 8)
|
||||||
@ -907,10 +907,10 @@ bool boolDefaultYes(const char *prompt)
|
|||||||
"Any response that does not begin with 'n' will mean Yes: ");
|
"Any response that does not begin with 'n' will mean Yes: ");
|
||||||
|
|
||||||
char answer[10];
|
char answer[10];
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
|
|
||||||
if(tolower(answer[0]) == 'n')
|
if(res != 0 && tolower(answer[0]) == 'n')
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
@ -982,7 +982,8 @@ RootPtr createV6Config( EncFS_Context *ctx, const std::string &rootDir,
|
|||||||
" anything else, or an empty line will select standard mode.\n"
|
" anything else, or an empty line will select standard mode.\n"
|
||||||
"?> ");
|
"?> ");
|
||||||
|
|
||||||
fgets( answer, sizeof(answer), stdin );
|
char *res = fgets( answer, sizeof(answer), stdin );
|
||||||
|
(void)res;
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user