projects
/
oweals
/
uclient.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eb850df
)
uclient-http: Close ustream file handle only if allocated
author
Tobias Schramm
<tobleminer@gmail.com>
Fri, 3 Aug 2018 21:39:21 +0000
(23:39 +0200)
committer
Jo-Philipp Wich
<jo@mein.io>
Fri, 3 Aug 2018 21:46:06 +0000
(23:46 +0200)
Since the connection setup in uclient_do_connect can fail before
ustream_init_fd is called we must check the fd was actually allocated
before closing it, else we would close STDIN.
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
uclient-http.c
patch
|
blob
|
history
diff --git
a/uclient-http.c
b/uclient-http.c
index ebe77582368ebee4f7a50482f49b154b12371b16..8d6d32734ba93286c968212945a66a56fb781257 100644
(file)
--- a/
uclient-http.c
+++ b/
uclient-http.c
@@
-149,7
+149,8
@@
static void uclient_http_disconnect(struct uclient_http *uh)
if (uh->ssl)
ustream_free(&uh->ussl.stream);
ustream_free(&uh->ufd.stream);
- close(uh->ufd.fd.fd);
+ if(uh->ufd.fd.fd)
+ close(uh->ufd.fd.fd);
uh->us = NULL;
}