cleanup: remove all dead assignments
As pointed out by clang-analyzer. PR-URL: https://github.com/libuv/libuv/pull/13 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
873b02607c
commit
18d58643af
@ -44,13 +44,10 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
|
||||
struct sockaddr_un saddr;
|
||||
const char* pipe_fname;
|
||||
int sockfd;
|
||||
int bound;
|
||||
int err;
|
||||
|
||||
pipe_fname = NULL;
|
||||
sockfd = -1;
|
||||
bound = 0;
|
||||
err = -EINVAL;
|
||||
|
||||
/* Already bound? */
|
||||
if (uv__stream_fd(handle) >= 0)
|
||||
@ -83,7 +80,6 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
|
||||
err = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
bound = 1;
|
||||
|
||||
/* Success. */
|
||||
handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */
|
||||
@ -91,11 +87,9 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
|
||||
return 0;
|
||||
|
||||
out:
|
||||
if (bound) {
|
||||
/* unlink() before uv__close() to avoid races. */
|
||||
assert(pipe_fname != NULL);
|
||||
unlink(pipe_fname);
|
||||
}
|
||||
/* unlink() before uv__close() to avoid races. */
|
||||
assert(pipe_fname != NULL);
|
||||
unlink(pipe_fname);
|
||||
uv__close(sockfd);
|
||||
free((void*)pipe_fname);
|
||||
return err;
|
||||
@ -158,7 +152,6 @@ void uv_pipe_connect(uv_connect_t* req,
|
||||
int r;
|
||||
|
||||
new_sock = (uv__stream_fd(handle) == -1);
|
||||
err = -EINVAL;
|
||||
|
||||
if (new_sock) {
|
||||
err = uv__socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
@ -549,7 +549,6 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
|
||||
if (server->accepted_fd == -1)
|
||||
return -EAGAIN;
|
||||
|
||||
err = 0;
|
||||
switch (client->type) {
|
||||
case UV_NAMED_PIPE:
|
||||
case UV_TCP:
|
||||
|
||||
@ -278,9 +278,6 @@ int uv__udp_bind(uv_udp_t* handle,
|
||||
int yes;
|
||||
int fd;
|
||||
|
||||
err = -EINVAL;
|
||||
fd = -1;
|
||||
|
||||
/* Check for bad flags. */
|
||||
if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR))
|
||||
return -EINVAL;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user