Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions misc/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cflags
Chnage
clangd
coreutils
coverity
DENABLE
DFETCHCONTENT
dont
Expand Down
8 changes: 4 additions & 4 deletions src/aws_sigv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static int32_t hash_init(void *ctx) {
ret = 0;
} else {
unsigned long err = ERR_get_error();
char err_buf[256];
char err_buf[256] = { 0 };
ERR_error_string_n(err, err_buf, sizeof(err_buf));
GGL_LOGE("EVP_DigestInit failed: %s", err_buf);
ret = -1;
Expand All @@ -45,7 +45,7 @@ static int32_t hash_update(void *ctx, const uint8_t *data, size_t data_len) {
ret = 0;
} else {
unsigned long err = ERR_get_error();
char err_buf[256];
char err_buf[256] = { 0 };
ERR_error_string_n(err, err_buf, sizeof(err_buf));
GGL_LOGE("EVP_DigestUpdate failed: %s", err_buf);
ret = -1;
Expand All @@ -66,7 +66,7 @@ static int32_t hash_final(
ret = 0;
} else {
unsigned long err = ERR_get_error();
char err_buf[256];
char err_buf[256] = { 0 };
ERR_error_string_n(err, err_buf, sizeof(err_buf));
GGL_LOGE("EVP_DigestFinal failed: %s", err_buf);
ret = -1;
Expand All @@ -76,7 +76,7 @@ static int32_t hash_final(
}

static GglError translate_sigv4_error(SigV4Status_t status) {
GglError ret = { 0 };
GglError ret;

switch (status) {
case SigV4Success:
Expand Down
4 changes: 2 additions & 2 deletions src/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ void slf_log_store_wait_for_upload_trigger(time_t timeout_sec) {

pthread_mutex_lock(&upload_mutex);
int wait_result = 0;
do {
while (!upload_now) {
wait_result
= pthread_cond_timedwait(&upload_cond, &upload_mutex, &timeout);
if (wait_result == ETIMEDOUT) {
GGL_LOGW("Timed out waiting for a upload.");
break;
}
} while (!upload_now);
}
upload_now = false;
pthread_mutex_unlock(&upload_mutex);
}
6 changes: 4 additions & 2 deletions src/system-log-forwarder.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static GglError drain_ring_buf_and_upload(

static void *consumer_thread(void *arg) {
Config *config = (Config *) arg;
uint8_t upload_mem[MAX_UPLOAD_SIZE] = { 0 };
static uint8_t upload_mem[MAX_UPLOAD_SIZE] = { 0 };
GglByteVec upload_doc = GGL_BYTE_VEC(upload_mem);
static uint8_t timestamp_mem[MAX_TIMESTAMP_DIGITS] = { 0 };
GglBuffer timestamp_as_buffer = GGL_BUF(timestamp_mem);
Expand All @@ -132,6 +132,7 @@ static void *consumer_thread(void *arg) {
);
}

// coverity[infinite_loop]
while (true) {
time_t now = time(NULL);
if (last_uploaded == 0) {
Expand Down Expand Up @@ -171,7 +172,6 @@ static void *consumer_thread(void *arg) {
ret
);
}
continue;
}
}
return NULL;
Expand Down Expand Up @@ -361,9 +361,11 @@ static error_t safe_str_to_int(const char *str, int *result) {

static error_t safe_str_to_size_t(const char *str, size_t *result) {
unsigned long temp_val = strtoul(str, NULL, 10);
#if ULONG_MAX > SIZE_MAX
if (temp_val > SIZE_MAX) {
return ARGP_ERR_UNKNOWN;
}
#endif
*result = (size_t) temp_val;
return 0;
}
Expand Down