Skip to content

Commit

Permalink
test_client: Don't segfault if file cannot be opened (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-andre authored Oct 28, 2024
1 parent acea9b0 commit f0413a6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,10 @@ save_session_cb(const char * data, size_t data_len, void *user_data)
printf("save_session_cb use server domain as the key. h3[%d]\n", user_conn->h3);

FILE * fp = fopen("test_session", "wb");
if (fp == NULL) {
printf("'test_session' open error");
return;
}
int write_size = fwrite(data, 1, data_len, fp);
if (data_len != write_size) {
printf("save _session_cb error\n");
Expand All @@ -798,6 +802,10 @@ save_tp_cb(const char * data, size_t data_len, void * user_data)
printf("save_tp_cb use server domain as the key. h3[%d]\n", user_conn->h3);

FILE * fp = fopen("tp_localhost", "wb");
if (fp == NULL) {
printf("'tp_localhost' open error");
return;
}
int write_size = fwrite(data, 1, data_len, fp);
if (data_len != write_size) {
printf("save _tp_cb error\n");
Expand Down

0 comments on commit f0413a6

Please sign in to comment.