Mail: use B_FILE_NAME_LENGTH as limit when saving drafts
This commit is contained in:
@@ -2548,14 +2548,10 @@ TMailWindow::SaveAsDraft()
|
|||||||
return status;
|
return status;
|
||||||
case B_OK:
|
case B_OK:
|
||||||
{
|
{
|
||||||
char fileName[512], *eofn;
|
char fileName[B_FILE_NAME_LENGTH], *eofn;
|
||||||
int32 i;
|
|
||||||
|
|
||||||
// save as some version of the message's subject
|
// save as some version of the message's subject
|
||||||
strncpy(fileName, fHeaderView->fSubject->Text(),
|
strlcpy(fileName, fHeaderView->fSubject->Text(),
|
||||||
sizeof(fileName)-10);
|
sizeof(fileName));
|
||||||
fileName[sizeof(fileName)-10]='\0';
|
|
||||||
// terminate like strncpy doesn't
|
|
||||||
eofn = fileName + strlen(fileName);
|
eofn = fileName + strlen(fileName);
|
||||||
|
|
||||||
// convert /, \ and : to -
|
// convert /, \ and : to -
|
||||||
@@ -2568,7 +2564,7 @@ TMailWindow::SaveAsDraft()
|
|||||||
|
|
||||||
// Create the file; if the name exists, find a unique name
|
// Create the file; if the name exists, find a unique name
|
||||||
flags = B_WRITE_ONLY | B_CREATE_FILE | B_FAIL_IF_EXISTS;
|
flags = B_WRITE_ONLY | B_CREATE_FILE | B_FAIL_IF_EXISTS;
|
||||||
for (i = 1; (status = draft.SetTo(&dir, fileName, flags))
|
for (int32 i = 1; (status = draft.SetTo(&dir, fileName, flags))
|
||||||
!= B_OK; i++) {
|
!= B_OK; i++) {
|
||||||
if (status != B_FILE_EXISTS)
|
if (status != B_FILE_EXISTS)
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
Reference in New Issue
Block a user