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;
|
struct sockaddr_un saddr;
|
||||||
const char* pipe_fname;
|
const char* pipe_fname;
|
||||||
int sockfd;
|
int sockfd;
|
||||||
int bound;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
pipe_fname = NULL;
|
pipe_fname = NULL;
|
||||||
sockfd = -1;
|
sockfd = -1;
|
||||||
bound = 0;
|
|
||||||
err = -EINVAL;
|
|
||||||
|
|
||||||
/* Already bound? */
|
/* Already bound? */
|
||||||
if (uv__stream_fd(handle) >= 0)
|
if (uv__stream_fd(handle) >= 0)
|
||||||
@ -83,7 +80,6 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
|
|||||||
err = -EACCES;
|
err = -EACCES;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
bound = 1;
|
|
||||||
|
|
||||||
/* Success. */
|
/* Success. */
|
||||||
handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */
|
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;
|
return 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (bound) {
|
/* unlink() before uv__close() to avoid races. */
|
||||||
/* unlink() before uv__close() to avoid races. */
|
assert(pipe_fname != NULL);
|
||||||
assert(pipe_fname != NULL);
|
unlink(pipe_fname);
|
||||||
unlink(pipe_fname);
|
|
||||||
}
|
|
||||||
uv__close(sockfd);
|
uv__close(sockfd);
|
||||||
free((void*)pipe_fname);
|
free((void*)pipe_fname);
|
||||||
return err;
|
return err;
|
||||||
@ -158,7 +152,6 @@ void uv_pipe_connect(uv_connect_t* req,
|
|||||||
int r;
|
int r;
|
||||||
|
|
||||||
new_sock = (uv__stream_fd(handle) == -1);
|
new_sock = (uv__stream_fd(handle) == -1);
|
||||||
err = -EINVAL;
|
|
||||||
|
|
||||||
if (new_sock) {
|
if (new_sock) {
|
||||||
err = uv__socket(AF_UNIX, SOCK_STREAM, 0);
|
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)
|
if (server->accepted_fd == -1)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
err = 0;
|
|
||||||
switch (client->type) {
|
switch (client->type) {
|
||||||
case UV_NAMED_PIPE:
|
case UV_NAMED_PIPE:
|
||||||
case UV_TCP:
|
case UV_TCP:
|
||||||
|
|||||||
@ -278,9 +278,6 @@ int uv__udp_bind(uv_udp_t* handle,
|
|||||||
int yes;
|
int yes;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
err = -EINVAL;
|
|
||||||
fd = -1;
|
|
||||||
|
|
||||||
/* Check for bad flags. */
|
/* Check for bad flags. */
|
||||||
if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR))
|
if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user