Skip to content

Commit

Permalink
src: fix logically dead code reported by Coverity
Browse files Browse the repository at this point in the history
Value of the `nwrite` variable will always be less than 0 when it
reaches the `switch` statement because of the previous check, which
causes `case 0` to never be executed, change the check to allow 0 or
less.

PR-URL: #48589
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
VoltrexKeyva committed Jul 4, 2023
1 parent 2f369cc commit 586fcff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/quic/session.cc
Expand Up @@ -792,7 +792,7 @@ uint64_t Session::SendDatagram(Store&& data) {
1,
uv_hrtime());

if (nwrite < 0) {
if (nwrite < 1) {
// Nothing was written to the packet.
switch (nwrite) {
case 0: {
Expand Down

0 comments on commit 586fcff

Please sign in to comment.