Skip to content

Commit 562f0ca

Browse files
committed
clean: avoid maybe-uninitialized
#3049
1 parent 9393dd3 commit 562f0ca

File tree

7 files changed

+23
-26
lines changed

7 files changed

+23
-26
lines changed

lib/core-net/wol.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ lws_wol(struct lws_context *ctx, const char *ip_or_NULL, uint8_t *mac_6_bytes)
7979
ret = 0;
8080

8181
bail:
82-
close(fd);
82+
if (fd >= 0) /* coverity */
83+
close(fd);
8384

8485
return ret;
8586
}

lib/core/logs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ __lws_lc_untag(struct lws_context *context, lws_lifecycle_t *lc)
179179

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

182-
lws_humanize(buf, sizeof(buf),
182+
#if defined(LWS_LOG_TAG_LIFECYCLE)
183+
if (lws_humanize(buf, sizeof(buf),
183184
(uint64_t)lws_now_usecs() - lc->us_creation,
184-
humanize_schema_us);
185+
humanize_schema_us) > 0)
185186

186-
#if defined(LWS_LOG_TAG_LIFECYCLE)
187187
lwsl_cx_notice(context, " -- %s (%d) %s", lc->gutag,
188188
(int)lc->list.owner->count - 1, buf);
189189
#endif

lib/roles/http/client/client-http.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static const char *digest_toks[] = {
591591
"response", // 1 << 5
592592
"opaque", // 1 << 6
593593
"qop", // 1 << 7
594-
"algorithm" // 1 << 8
594+
"algorithm", // 1 << 8
595595
"nc", // 1 << 9
596596
"cnonce", // 1 << 10
597597
"domain", // 1 << 11
@@ -1062,27 +1062,23 @@ lws_client_interpret_server_handshake(struct lws *wsi)
10621062
n = atoi(p);
10631063

10641064
#if defined(LWS_WITH_HTTP_DIGEST_AUTH)
1065-
if (n == 401 && lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE)) {
1066-
if (!(wsi->stash && wsi->stash->cis[CIS_USERNAME] &&
1067-
wsi->stash->cis[CIS_PASSWORD])) {
1068-
lwsl_err(
1069-
"Digest auth requested by server but no credentials provided "
1070-
"by user\n");
1071-
return LCBA_FAILED_AUTH;
1072-
}
1073-
1074-
if (0 != lws_http_digest_auth(wsi)) {
1075-
if (wsi)
1076-
goto bail3;
1077-
return 1;
1078-
}
1065+
if (n == 401 && lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE)) {
1066+
if (!(wsi->stash && wsi->stash->cis[CIS_USERNAME] &&
1067+
wsi->stash->cis[CIS_PASSWORD])) {
1068+
lwsl_err("Digest auth requested by server but no credentials provided by user\n");
1069+
1070+
return LCBA_FAILED_AUTH;
1071+
}
1072+
1073+
if (lws_http_digest_auth(wsi))
1074+
goto bail3;
10791075

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

10841080
return -1;
1085-
}
1081+
}
10861082

10871083
ah = wsi->http.ah;
10881084
#endif

lib/roles/http/date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ lws_http_date_parse_unix(const char *b, size_t len, time_t *t)
150150
#endif
151151
#endif
152152

153-
return (int)*t == -1 ? -1 : 0;
153+
return (int)(*t == -1 ? -1 : 0);
154154
}
155155

156156
#if defined(LWS_WITH_CLIENT)

lib/roles/http/server/server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ _lws_vhost_init_server_af(struct vh_sock_args *a)
9393
int n, opt = 1, limit = 1, san = 2;
9494
lws_sockfd_type sockfd;
9595
struct lws *wsi;
96-
int m = 0, is;
96+
int m = 0, is = 0;
9797
#if defined(LWS_WITH_IPV6)
9898
int value = 1;
9999
#endif

lib/system/smd/smd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,9 @@ _lws_smd_msg_deliver_peer(struct lws_context *ctx, lws_smd_peer_t *pr)
534534
msg = lws_container_of(pr->tail, lws_smd_msg_t, list);
535535

536536

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

541541
pr->cb(pr->opaque, msg->_class, msg->timestamp,
542542
((uint8_t *)&msg[1]) + LWS_SMD_SS_RX_HEADER_LEN_EFF,

lib/tls/tls-network.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ lws_tls_check_cert_lifetime(struct lws_vhost *v)
9090
return 1;
9191

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

0 commit comments

Comments
 (0)