gmni

a gemini line mode client
git clone https://git.clttr.info/gmni.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 8d12169819203e0c1d2d94ed7ec4d86a177d00ea
parent ee019da67f8e18baeea52a514a48dc6cdeb35d53
Author: Ondřej Fiala <ofiala@airmail.cc>
Date:   Sat, 13 Apr 2024 01:30:58 +0200

client: save errno properly in file_request

Diffstat:
Msrc/client.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/client.c b/src/client.c @@ -169,16 +169,16 @@ file_request(const char *path, struct gemini_response *resp) } while ((nread = read(fd, &resp->body[len], BUFSIZ)) > 0); resp->body[len] = '\0'; + int e = errno; close(fd); if (nread < 0) { - int e = errno; free(resp->meta); free(resp->body); resp->meta = NULL; resp->body = NULL; if (e == EISDIR) { resp->status = GEMINI_STATUS_BAD_REQUEST; - resp->meta = strdup(strerror(errno)); + resp->meta = strdup(strerror(e)); } else { res = GEMINI_ERR_IO; }