Skip to content

Commit 16b5b98

Browse files
authored
Merge pull request #138 from opensensor/ai-findings-autofix/src-web-api_handlers_system_logs.c
Potential fixes for 2 code quality findings
2 parents fe64706 + e4118e5 commit 16b5b98

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/web/api_handlers_system_logs.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,8 @@ void handle_get_system_logs(const http_request_t *req, http_response_t *res) {
327327

328328
// Get system logs
329329
char **logs = NULL;
330-
// max_log_count is the input (maximum number of logs requested)
331330
// actual_log_count is the output (actual number of logs returned) by get_json_logs_tail().
332-
int max_log_count = DEFAULT_MAX_LOG_ENTRIES; // Input: maximum number of logs to return
333-
int actual_log_count = max_log_count; // Will be updated by get_json_logs_tail()
331+
int actual_log_count = 0; // Will be updated by get_json_logs_tail()
334332

335333
// Second argument is the optional source/filter/context; NULL means "no specific filter" (use default system logs)
336334
// Note: actual_log_count is updated by get_json_logs_tail() to the actual number of logs returned.
@@ -397,8 +395,8 @@ void handle_get_system_logs(const http_request_t *req, http_response_t *res) {
397395
cJSON *message_json = cJSON_GetObjectItem(log_json, "message");
398396

399397
const char *timestamp = timestamp_json && cJSON_IsString(timestamp_json) ? timestamp_json->valuestring : "Unknown";
400-
const char *log_level = level_json && cJSON_IsString(level_json) ? level_json->valuestring : "info";
401-
const char *message = message_json && cJSON_IsString(message_json) ? message_json->valuestring : "";
398+
const char *log_level = level_json && cJSON_IsString(level_json) ? level_json->valuestring : "Unknown";
399+
const char *message = message_json && cJSON_IsString(message_json) ? message_json->valuestring : "Unknown";
402400

403401
// Check if this log meets the minimum level
404402
if (log_level_meets_minimum(log_level, level)) {

0 commit comments

Comments
 (0)