Skip to content

Commit

Permalink
clean: avoid maybe-uninitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
lws-team committed Jan 15, 2024
1 parent 9393dd3 commit 562f0ca
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
3 changes: 2 additions & 1 deletion lib/core-net/wol.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)
ret = 0;

bail:
close(fd);
if (fd >= 0) /* coverity */
close(fd);

return ret;
}
6 changes: 3 additions & 3 deletions lib/core/logs.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ __lws_lc_untag(struct lws_context *context, lws_lifecycle_t *lc)

//grp = lws_container_of(lc->list.owner, lws_lifecycle_group_t, owner);

lws_humanize(buf, sizeof(buf),
#if defined(LWS_LOG_TAG_LIFECYCLE)
if (lws_humanize(buf, sizeof(buf),
(uint64_t)lws_now_usecs() - lc->us_creation,
humanize_schema_us);
humanize_schema_us) > 0)

#if defined(LWS_LOG_TAG_LIFECYCLE)
lwsl_cx_notice(context, " -- %s (%d) %s", lc->gutag,
(int)lc->list.owner->count - 1, buf);
#endif
Expand Down
28 changes: 12 additions & 16 deletions lib/roles/http/client/client-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ static const char *digest_toks[] = {
"response", // 1 << 5
"opaque", // 1 << 6
"qop", // 1 << 7
"algorithm" // 1 << 8
"algorithm", // 1 << 8
"nc", // 1 << 9
"cnonce", // 1 << 10
"domain", // 1 << 11
Expand Down Expand Up @@ -1062,27 +1062,23 @@ lws_client_interpret_server_handshake(struct lws *wsi)
n = atoi(p);

#if defined(LWS_WITH_HTTP_DIGEST_AUTH)
if (n == 401 && lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE)) {
if (!(wsi->stash && wsi->stash->cis[CIS_USERNAME] &&
wsi->stash->cis[CIS_PASSWORD])) {
lwsl_err(
"Digest auth requested by server but no credentials provided "
"by user\n");
return LCBA_FAILED_AUTH;
}

if (0 != lws_http_digest_auth(wsi)) {
if (wsi)
goto bail3;
return 1;
}
if (n == 401 && lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE)) {
if (!(wsi->stash && wsi->stash->cis[CIS_USERNAME] &&
wsi->stash->cis[CIS_PASSWORD])) {
lwsl_err("Digest auth requested by server but no credentials provided by user\n");

return LCBA_FAILED_AUTH;
}

if (lws_http_digest_auth(wsi))
goto bail3;

opaque = wsi->a.opaque_user_data;
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "digest_auth_step2");
wsi->a.opaque_user_data = opaque;

return -1;
}
}

ah = wsi->http.ah;
#endif
Expand Down
2 changes: 1 addition & 1 deletion lib/roles/http/date.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ lws_http_date_parse_unix(const char *b, size_t len, time_t *t)
#endif
#endif

return (int)*t == -1 ? -1 : 0;
return (int)(*t == -1 ? -1 : 0);
}

#if defined(LWS_WITH_CLIENT)
Expand Down
2 changes: 1 addition & 1 deletion lib/roles/http/server/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ _lws_vhost_init_server_af(struct vh_sock_args *a)
int n, opt = 1, limit = 1, san = 2;
lws_sockfd_type sockfd;
struct lws *wsi;
int m = 0, is;
int m = 0, is = 0;
#if defined(LWS_WITH_IPV6)
int value = 1;
#endif
Expand Down
4 changes: 2 additions & 2 deletions lib/system/smd/smd.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,9 @@ _lws_smd_msg_deliver_peer(struct lws_context *ctx, lws_smd_peer_t *pr)
msg = lws_container_of(pr->tail, lws_smd_msg_t, list);


lwsl_cx_info(ctx, "deliver cl 0x%x, len %d, refc %d, to peer %p",
lwsl_cx_info(ctx, "deliver cl 0x%x, len %d, to peer %p",
(unsigned int)msg->_class, (int)msg->length,
(int)msg->refcount, pr);
pr);

pr->cb(pr->opaque, msg->_class, msg->timestamp,
((uint8_t *)&msg[1]) + LWS_SMD_SS_RX_HEADER_LEN_EFF,
Expand Down
4 changes: 2 additions & 2 deletions lib/tls/tls-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ lws_tls_check_cert_lifetime(struct lws_vhost *v)
return 1;

life = (ir.time - now) / (24 * 3600);
lwsl_vhost_notice(v, " vhost %s: cert expiry: %dd", v->name,
(int)life);
lwsl_vhost_notice(v, " vhost %s: cert expiry: %lldd", v->name,
(long long)life);
} else
lwsl_vhost_info(v, " vhost %s: no cert", v->name);

Expand Down

0 comments on commit 562f0ca

Please sign in to comment.