write_read_attr: fix truncated B_MAIL_ATTR_STATUS

This fix garbage attributes on e-mail messages on status changes.

Change-Id: I5293a0e71a1b84c04889fa3375488b0075aad12e
Reviewed-on: https://review.haiku-os.org/682
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Peter Kosyh
2018-11-11 14:26:55 +00:00
committed by waddlesplash
parent 23623eee9a
commit fea29e79c7
+3 -4
View File
@@ -171,10 +171,9 @@ write_read_attr(BNode& node, read_flags flag)
return B_OK;
}
const char* statusString = flag == B_READ ? "Read"
: flag == B_SEEN ? "Seen" : "New";
if (node.WriteAttr(B_MAIL_ATTR_STATUS, B_STRING_TYPE, 0, statusString,
strlen(statusString)) < 0)
BString statusString = flag == B_READ ? "Read"
: flag == B_SEEN ? "Seen" : "New";
if (node.WriteAttrString(B_MAIL_ATTR_STATUS, &statusString) < 0)
return B_ERROR;
return B_OK;