From db0ca3fd4788c661b1a0244973e11863b78cf2cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Fri, 1 Dec 2023 11:43:10 +0900 Subject: [PATCH] fix(server): goto jumps into pthread_cleanup_push --- server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.c b/server.c index 26361e4..45bcfcb 100644 --- a/server.c +++ b/server.c @@ -296,13 +296,13 @@ static int s3_set_data(tcpool_thread_timer_t *timer) { if(getsockopt(timer->accept_fd, SOL_SOCKET, SO_RCVBUF, &recv_bufsz, &optlen)) { perror("getsockopt"); *(uint32_t*)ret = *(uint32_t*)"erop"; - goto S3_RETURN; + goto S3_SKIP; } printf("Set recv buffer size: %d\n", recv_bufsz); file_cache_t* fc = timer->isdata?&data_file_cache:&kanban_file_cache; if(file_cache_write_lock(fc)) { *(uint32_t*)ret = *(uint32_t*)"erwl"; - goto S3_RETURN; + goto S3_SKIP; } pthread_cleanup_push((void (*)(void*))&file_cache_unlock, (void*)fc); if(timer->numbytes < 4) { @@ -359,6 +359,7 @@ static int s3_set_data(tcpool_thread_timer_t *timer) { puts("Finish loop recv"); S3_RETURN: pthread_cleanup_pop(1); +S3_SKIP: return send_data(timer->accept_fd, ret, 4); }