mirror of
https://github.com/git/git.git
synced 2024-04-27 10:35:08 +02:00
Merge branch 'ab/trace2-squelch-gcc-warning'
Workaround compiler warnings. * ab/trace2-squelch-gcc-warning: trace2: refactor to avoid gcc warning under -O3
This commit is contained in:
commit
ac2158649d
|
@ -204,15 +204,16 @@ static int tr2_dst_try_uds_connect(const char *path, int sock_type, int *out_fd)
|
||||||
|
|
||||||
fd = socket(AF_UNIX, sock_type, 0);
|
fd = socket(AF_UNIX, sock_type, 0);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return errno;
|
return -1;
|
||||||
|
|
||||||
sa.sun_family = AF_UNIX;
|
sa.sun_family = AF_UNIX;
|
||||||
strlcpy(sa.sun_path, path, sizeof(sa.sun_path));
|
strlcpy(sa.sun_path, path, sizeof(sa.sun_path));
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
|
if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
|
||||||
int e = errno;
|
int saved_errno = errno;
|
||||||
close(fd);
|
close(fd);
|
||||||
return e;
|
errno = saved_errno;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_fd = fd;
|
*out_fd = fd;
|
||||||
|
@ -227,7 +228,6 @@ static int tr2_dst_try_unix_domain_socket(struct tr2_dst *dst,
|
||||||
{
|
{
|
||||||
unsigned int uds_try = 0;
|
unsigned int uds_try = 0;
|
||||||
int fd;
|
int fd;
|
||||||
int e;
|
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -271,15 +271,13 @@ static int tr2_dst_try_unix_domain_socket(struct tr2_dst *dst,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uds_try & TR2_DST_UDS_TRY_STREAM) {
|
if (uds_try & TR2_DST_UDS_TRY_STREAM) {
|
||||||
e = tr2_dst_try_uds_connect(path, SOCK_STREAM, &fd);
|
if (!tr2_dst_try_uds_connect(path, SOCK_STREAM, &fd))
|
||||||
if (!e)
|
|
||||||
goto connected;
|
goto connected;
|
||||||
if (e != EPROTOTYPE)
|
if (errno != EPROTOTYPE)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (uds_try & TR2_DST_UDS_TRY_DGRAM) {
|
if (uds_try & TR2_DST_UDS_TRY_DGRAM) {
|
||||||
e = tr2_dst_try_uds_connect(path, SOCK_DGRAM, &fd);
|
if (!tr2_dst_try_uds_connect(path, SOCK_DGRAM, &fd))
|
||||||
if (!e)
|
|
||||||
goto connected;
|
goto connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +285,7 @@ static int tr2_dst_try_unix_domain_socket(struct tr2_dst *dst,
|
||||||
if (tr2_dst_want_warning())
|
if (tr2_dst_want_warning())
|
||||||
warning("trace2: could not connect to socket '%s' for '%s' tracing: %s",
|
warning("trace2: could not connect to socket '%s' for '%s' tracing: %s",
|
||||||
path, tr2_sysenv_display_name(dst->sysenv_var),
|
path, tr2_sysenv_display_name(dst->sysenv_var),
|
||||||
strerror(e));
|
strerror(errno));
|
||||||
|
|
||||||
tr2_dst_trace_disable(dst);
|
tr2_dst_trace_disable(dst);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue