tskrtt

Simple libev based gopher server
git clone https://git.inz.fi/tskrtt/
Log | Files | Refs | README

commit 3b0003455b4e58c3a8aaad5b56be73cdb907f6c9
parent 4942d295cc93007df376fb2a325fcf6336702ab5
Author: Santtu Lakkala <inz@inz.fi>
Date:   Sat, 15 May 2021 23:40:24 +0300

Handle mmap failure gracefully

Diffstat:
Mmain.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c @@ -536,6 +536,9 @@ static void init_binary(EV_P_ struct client *c, int fd, struct stat *sb, const c ssize_t wr = 0; int w; + if (!data) + return; + while (wr < sb->st_size) { if ((w = client_write(c, data + wr, sb->st_size - wr)) <= 0) break; @@ -545,8 +548,6 @@ static void init_binary(EV_P_ struct client *c, int fd, struct stat *sb, const c munmap(data, sb->st_size); client_close(EV_A_ c); - - return; } }