mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
coverity: cleanup
This commit is contained in:
parent
94e375f552
commit
69d9cf2e6b
9 changed files with 28 additions and 14 deletions
|
@ -2059,14 +2059,17 @@ lws_context_destroy2(struct lws_context *context)
|
|||
|
||||
if (context->event_loop_ops->destroy_context2)
|
||||
if (context->event_loop_ops->destroy_context2(context)) {
|
||||
lws_context_unlock(context); /* } context ----------- */
|
||||
context->finalize_destroy_after_internal_loops_stopped = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context->pt[0].event_loop_foreign)
|
||||
for (n = 0; n < context->count_threads; n++)
|
||||
if (context->pt[n].inside_service)
|
||||
if (context->pt[n].inside_service) {
|
||||
lws_context_unlock(context); /* } context --- */
|
||||
return;
|
||||
}
|
||||
|
||||
lws_context_unlock(context); /* } context ------------------- */
|
||||
|
||||
|
|
|
@ -105,7 +105,11 @@ int lws_open(const char *__file, int __oflag, ...)
|
|||
n = open(__file, __oflag);
|
||||
va_end(ap);
|
||||
|
||||
lws_plat_apply_FD_CLOEXEC(n);
|
||||
if (n != -1 && lws_plat_apply_FD_CLOEXEC(n)) {
|
||||
close(n);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -1370,7 +1370,7 @@ lws_plat_pipe_close(struct lws *wsi);
|
|||
int
|
||||
lws_create_event_pipes(struct lws_context *context);
|
||||
|
||||
void
|
||||
int
|
||||
lws_plat_apply_FD_CLOEXEC(int n);
|
||||
|
||||
const struct lws_plat_file_ops *
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
#include <lwip/sockets.h>
|
||||
#include <esp_task_wdt.h>
|
||||
|
||||
void lws_plat_apply_FD_CLOEXEC(int n)
|
||||
int lws_plat_apply_FD_CLOEXEC(int n)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
* included from libwebsockets.c for OPTEE builds
|
||||
*/
|
||||
|
||||
void lws_plat_apply_FD_CLOEXEC(int n)
|
||||
int lws_plat_apply_FD_CLOEXEC(int n)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -30,10 +30,12 @@
|
|||
#endif
|
||||
#include <dirent.h>
|
||||
|
||||
void lws_plat_apply_FD_CLOEXEC(int n)
|
||||
int lws_plat_apply_FD_CLOEXEC(int n)
|
||||
{
|
||||
if (n != -1)
|
||||
fcntl(n, F_SETFD, FD_CLOEXEC );
|
||||
if (n == -1)
|
||||
return 0;
|
||||
|
||||
return fcntl(n, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -74,7 +74,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
|
|||
struct protoent *tcp_proto;
|
||||
#endif
|
||||
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
if (vhost->ka_time) {
|
||||
/* enable keepalive on this socket */
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
#endif
|
||||
#include "core/private.h"
|
||||
|
||||
void lws_plat_apply_FD_CLOEXEC(int n)
|
||||
int lws_plat_apply_FD_CLOEXEC(int n)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lws_fop_fd_t
|
||||
|
|
|
@ -885,7 +885,9 @@ agin:
|
|||
|
||||
/* payload processing */
|
||||
|
||||
m = !wsi->http.cgi->implied_chunked && !wsi->http2_substream && !wsi->http.cgi->explicitly_chunked && !wsi->http.cgi->content_length;
|
||||
m = !wsi->http.cgi->implied_chunked && !wsi->http2_substream &&
|
||||
!wsi->http.cgi->explicitly_chunked &&
|
||||
!wsi->http.cgi->content_length;
|
||||
n = lws_get_socket_fd(wsi->http.cgi->stdwsi[LWS_STDOUT]);
|
||||
if (n < 0)
|
||||
return -1;
|
||||
|
@ -904,15 +906,14 @@ agin:
|
|||
return 0;
|
||||
}
|
||||
|
||||
n = read(n, start, sizeof(buf) - LWS_PRE -
|
||||
(m ? LWS_HTTP_CHUNK_HDR_SIZE : 0));
|
||||
n = read(n, start, sizeof(buf) - LWS_PRE);
|
||||
|
||||
if (n < 0 && errno != EAGAIN) {
|
||||
lwsl_debug("%s: stdout read says %d\n", __func__, n);
|
||||
return -1;
|
||||
}
|
||||
if (n > 0) {
|
||||
|
||||
/*
|
||||
if (!wsi->http2_substream && m) {
|
||||
char chdr[LWS_HTTP_CHUNK_HDR_SIZE];
|
||||
m = lws_snprintf(chdr, LWS_HTTP_CHUNK_HDR_SIZE - 3,
|
||||
|
@ -922,6 +923,7 @@ agin:
|
|||
memcpy(start + m + n, "\x0d\x0a", 2);
|
||||
n += m + 2;
|
||||
}
|
||||
*/
|
||||
cmd = LWS_WRITE_HTTP;
|
||||
if (wsi->http.cgi->content_length_seen + n == wsi->http.cgi->content_length)
|
||||
cmd = LWS_WRITE_HTTP_FINAL;
|
||||
|
|
Loading…
Add table
Reference in a new issue