| 4395 | ds4_kvstore_fill_header(h, (uint8_t)model_id, (uint8_t)quant_bits, |
| 4396 | ds4_kvstore_reason_code(reason), |
| 4397 | session_identity ? DS4_KVSTORE_EXT_SESSION_TITLE : 0, |
| 4398 | (uint32_t)tokens->len, 0, |
| 4399 | (uint32_t)ds4_session_ctx(w->session), |
| 4400 | created_at, now, payload_bytes); |
| 4401 | uint8_t tb[4]; |
| 4402 | ds4_kvstore_le_put32(tb, (uint32_t)text_len); |
| 4403 | |
| 4404 | errno = 0; |
| 4405 | bool ok = fwrite(h, 1, sizeof(h), fp) == sizeof(h) && |
| 4406 | fwrite(tb, 1, sizeof(tb), fp) == sizeof(tb) && |
| 4407 | fwrite(text, 1, text_len, fp) == text_len && |
| 4408 | ds4_session_write_staged_payload(&staged, fp, |
| 4409 | save_err, sizeof(save_err)) == 0 && |
| 4410 | (!session_identity || |
no test coverage detected