Skip to content

Commit 04f8b09

Browse files
committed
Remove redundant NetIPC server guards
1 parent 1c60935 commit 04f8b09

3 files changed

Lines changed: 39 additions & 5 deletions

File tree

.agents/sow/current/SOW-0015-20260605-codacy-scope-and-maintainability.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,40 @@ Validation completed for this duplication-reduction increment:
704704
- Win11 temp-copy C validation: MSYS CMake build of `test_win_service`, `test_win_service_extra`, and `test_win_service_payload_limits` passed; CTest for those three tests passed.
705705
- `bash .agents/sow/audit.sh`: passed.
706706

707+
### 2026-06-07 - Netdata PR #22649 post-push scanner pass
708+
709+
- Rechecked Netdata PR #22649 after vendoring SDK commit `1c6093540d0c` into Netdata commit `50a9c100ec0c`.
710+
- GitHub review state:
711+
- review threads: 8 total, 0 open.
712+
- review decision remains `REVIEW_REQUIRED`.
713+
- SonarCloud state:
714+
- open issues: 0.
715+
- open hotspots: 0.
716+
- quality gate still reports duplication failure, but `project_pull_requests/list` shows SonarCloud's latest PR analysis is for old Netdata commit `86c0aa015f73`, not current PR head `50a9c100ec0c`.
717+
- The stale SonarCloud duplication component list still names files that were changed by the latest duplication cleanup, so it must not be treated as current evidence until SonarCloud reanalyzes the latest head.
718+
- Codacy state on current Netdata PR head:
719+
- GitHub check `Codacy Static Code Analysis`: `ACTION_REQUIRED`.
720+
- Repo-local Codacy API fetch returned 155 live `Added` issues and 25 already `Fixed` issues.
721+
- Live `Added` issues are:
722+
- 84 `cppcheck_missingIncludeSystem` reports against standard/POSIX/Windows system headers such as `<stdint.h>`, `<string.h>`, `<unistd.h>`, and `<windows.h>`.
723+
- 66 `cppcheck_unusedStructMember` reports against C wire-layout/internal operation structs.
724+
- 5 `cppcheck_knownConditionTrueFalse` reports against split C server init paths.
725+
- Already `Fixed` Codacy reports include all `flawfinder_strncpy`, `flawfinder_usleep`, and `cppcheck_unreadVariable` findings from older PR commits.
726+
- Verified the 5 live `cppcheck_knownConditionTrueFalse` reports are real but low risk: both split server init functions reject `NULL` `config` before the flagged assignments.
727+
- Fixed the redundant split-server `config` guards in:
728+
- `src/libnetdata/netipc/src/service/netipc_service_posix_server.c`
729+
- `src/libnetdata/netipc/src/service/netipc_service_win_server.c`
730+
- Validation for the split-server guard cleanup:
731+
- `git diff --check`: passed.
732+
- POSIX focused build of `test_service`, `test_service_extra`, and `test_service_payload_limits`: passed.
733+
- `/usr/bin/ctest --test-dir build --output-on-failure -R 'test_service|test_service_extra|test_service_payload_limits'`: 9/9 matching service tests passed.
734+
- Win11 MSYS focused build of `test_win_service`, `test_win_service_extra`, and `test_win_service_payload_limits`: passed.
735+
- Win11 MSYS CTest for the same three targets: 3/3 passed.
736+
- `bash .agents/sow/audit.sh`: passed.
737+
- Scanner-policy decision still needed before the Netdata PR can become Codacy-clean:
738+
- `cppcheck_missingIncludeSystem` appears non-actionable in Codacy because it cannot see ordinary system headers in the analyzer environment.
739+
- `cppcheck_unusedStructMember` is noisy for NetIPC wire-layout structs and internal callback tables, but disabling it affects the whole Netdata repository unless a narrower suppression path is chosen.
740+
707741
## Validation
708742

709743
Acceptance criteria evidence:

src/libnetdata/netipc/src/service/netipc_service_posix_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ nipc_error_t nipc_service_platform_server_init_raw(
129129
server->expected_method_code = expected_method_code;
130130
server->base_config = *config;
131131
server->learned_request_payload_bytes =
132-
(config && config->max_request_payload_bytes > 0)
132+
config->max_request_payload_bytes > 0
133133
? config->max_request_payload_bytes
134134
: NIPC_MAX_PAYLOAD_DEFAULT;
135135
server->learned_response_payload_bytes =
136-
(config && config->max_response_payload_bytes > 0)
136+
config->max_response_payload_bytes > 0
137137
? config->max_response_payload_bytes
138138
: NIPC_MAX_PAYLOAD_DEFAULT;
139139

src/libnetdata/netipc/src/service/netipc_service_win_server.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ nipc_error_t nipc_service_platform_server_init_raw(
208208
server->expected_method_code = expected_method_code;
209209
server->base_config = *config;
210210
server->learned_request_payload_bytes =
211-
(config && config->max_request_payload_bytes > 0)
211+
config->max_request_payload_bytes > 0
212212
? config->max_request_payload_bytes
213213
: NIPC_MAX_PAYLOAD_DEFAULT;
214214
server->learned_response_payload_bytes =
215-
(config && config->max_response_payload_bytes > 0)
215+
config->max_response_payload_bytes > 0
216216
? config->max_response_payload_bytes
217217
: NIPC_MAX_PAYLOAD_DEFAULT;
218-
server->auth_token = config ? config->auth_token : 0;
218+
server->auth_token = config->auth_token;
219219

220220

221221
/* Initialize session tracking */

0 commit comments

Comments
 (0)