add code to silence false positive warning in gcc6.3

This commit is contained in:
Florian Dold 2017-02-07 18:21:29 +01:00
parent 49539d8f93
commit 4c47cbcc5c
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -1125,12 +1125,16 @@ main (int argc,
{ {
MHD_socket sock = MHD_quiesce_daemon (mhd); MHD_socket sock = MHD_quiesce_daemon (mhd);
MHD_socket admin_sock; MHD_socket admin_sock;
int admin_sock_opened = GNUNET_NO;
pid_t chld; pid_t chld;
int flags; int flags;
/* Set flags to make 'sock' inherited by child */ /* Set flags to make 'sock' inherited by child */
if (NULL != mhd_admin) if (NULL != mhd_admin)
{
admin_sock = MHD_quiesce_daemon (mhd_admin); admin_sock = MHD_quiesce_daemon (mhd_admin);
admin_sock_opened = GNUNET_YES;
}
flags = fcntl (sock, F_GETFD); flags = fcntl (sock, F_GETFD);
GNUNET_assert (-1 != flags); GNUNET_assert (-1 != flags);
flags &= ~FD_CLOEXEC; flags &= ~FD_CLOEXEC;
@ -1154,7 +1158,7 @@ main (int argc,
"dup2"); "dup2");
_exit (1); _exit (1);
} }
if ( (NULL != mhd_admin) && if ( (GNUNET_YES == admin_sock_opened) &&
(4 != dup2 (admin_sock, 4)) ) (4 != dup2 (admin_sock, 4)) )
{ {
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
@ -1179,7 +1183,7 @@ main (int argc,
before exiting; as the listen socket is no longer used, before exiting; as the listen socket is no longer used,
close it here */ close it here */
GNUNET_break (0 == close (sock)); GNUNET_break (0 == close (sock));
if (NULL != mhd_admin) if (GNUNET_YES == admin_sock_opened)
GNUNET_break (0 == close (admin_sock)); GNUNET_break (0 == close (admin_sock));
while ( (0 != MHD_get_daemon_info (mhd, while ( (0 != MHD_get_daemon_info (mhd,
MHD_DAEMON_INFO_CURRENT_CONNECTIONS)->num_connections) || MHD_DAEMON_INFO_CURRENT_CONNECTIONS)->num_connections) ||