brewery
notashelf /
d16a861e52beb5a1a0cba944ab30680f582b3b08

chroma

public

Lightweight wallpaper daemon for Wayland

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/chroma.git

Commit d16a861e52be

tarball

raf <raf@notashelf.dev> · 2025-11-02 17:57 UTC

1 files changed+7-1
Merge pull request 'meta: fix the warning during compilation' (#7) from amr-patch-2 into main

Reviewed-on: https://git.frzn.dev/NotAShelf/chroma/pulls/7
Reviewed-by: raf <raf@notashelf.dev>
diff --git a/src/core.c b/src/core.cindex 63d904d..909caa1 100644--- a/src/core.c+++ b/src/core.c@@ -364,17 +364,23 @@ void chroma_log(const char *level, const char *format, ...) {    va_list args;   char timestamp[32];+  int truncation_check = 0;   struct timeval tv;   struct tm *tm_info;    gettimeofday(&tv, NULL);   tm_info = localtime(&tv.tv_sec); -  snprintf(timestamp, sizeof(timestamp), "%04d-%02d-%02d %02d:%02d:%02d.%03d",+  truncation_check = snprintf(timestamp, sizeof(timestamp), "%04d-%02d-%02d %02d:%02d:%02d.%03d",            tm_info->tm_year + 1900, tm_info->tm_mon + 1, tm_info->tm_mday,            tm_info->tm_hour, tm_info->tm_min, tm_info->tm_sec,            (int)(tv.tv_usec / 1000)); +  if(truncation_check > 32 || truncation_check < 0) {+    // Something went seriously wrong with the snprintf, this is a fairly serious error as+    // the timestamp may be incomplete or corrupted, so print a warning+    printf("Following timestamp may be incomplete, truncated or corrupted!\n");+  }   printf("[%s] %s: ", timestamp, level);    va_start(args, format);