fix for #97585. if the user happens to have a directory for their sig file, don't go into

an infinite loop.  r=ducarroz, sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2001-09-05 22:24:43 +00:00
parent 98e563eca4
commit c19061cb8d
4 changed files with 18 additions and 2 deletions

View File

@ -557,10 +557,16 @@ nsMsgI18NParseMetaCharset(nsFileSpec* fileSpec)
{
static char charset[kMAX_CSNAME+1];
char buffer[512];
nsInputFileStream fileStream(*fileSpec);
*charset = '\0';
if (fileSpec->IsDirectory()) {
NS_ASSERTION(0,"file is a directory");
return charset;
}
nsInputFileStream fileStream(*fileSpec);
while (!fileStream.eof() && !fileStream.failed() &&
fileStream.is_open()) {
fileStream.readline(buffer, 512);

View File

@ -191,6 +191,10 @@ noIdentities=You don't have any email identities yet. Create one with the Accou
## @name NS_MSG_GENERIC_FAILURE_EXPLANATION
12562=Please verify that your Mail/News account settings are correct and try again.
## @name NS_MSG_ERROR_READING_FILE
12563=Error reading file.
## @name NS_FOLLOWUPTO_SENDER
12563=The author of this message has requested that responses be sent only to the author. If you also want to reply to the newsgroup, add a new row to the addressing area, choose Newsgroup from the recipients list, and enter the name of the newsgroup.

View File

@ -2559,9 +2559,14 @@ nsMsgCompose::LoadDataFromFile(nsFileSpec& fSpec, nsString &sigData)
char *readBuf;
char *ptr;
if (fSpec.IsDirectory()) {
NS_ASSERTION(0,"file is a directory");
return NS_MSG_ERROR_READING_FILE;
}
nsInputFileStream tempFile(fSpec);
if (!tempFile.is_open())
return NS_MSG_ERROR_WRITING_FILE;
return NS_MSG_ERROR_READING_FILE;
readSize = fSpec.GetFileSize();
ptr = readBuf = (char *)PR_Malloc(readSize + 1); if (!readBuf)

View File

@ -112,6 +112,7 @@ private:
#define NS_ERROR_SEND_FAILED_BUT_NNTP_OK NS_MSG_GENERATE_FAILURE(12560)
#define NS_MSG_ASK_TO_COMEBACK_TO_COMPOSE NS_MSG_GENERATE_SUCCESS(12561)
#define NS_MSG_GENERIC_FAILURE_EXPLANATION NS_MSG_GENERATE_SUCCESS(12562)
#define NS_MSG_ERROR_READING_FILE NS_MSG_GENERATE_FAILURE(12563)
#endif /* _nsMsgComposeStringBundle_H_ */