From f1464751aef4b2a56a0ad4e446c9f33147a8c29b Mon Sep 17 00:00:00 2001 From: javalsai Date: Wed, 16 Jul 2025 19:04:58 +0200 Subject: [PATCH] fix: format and linter errors --- src/auth.c | 2 +- src/config.c | 2 +- src/log.c | 4 ++-- src/ui.c | 4 ++-- src/util.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/auth.c b/src/auth.c index 18313d9..8750c2c 100644 --- a/src/auth.c +++ b/src/auth.c @@ -36,7 +36,7 @@ int pam_conversation(int num_msg, const struct pam_message** msg, } #ifndef PAM_SERVICE_FALLBACK -#define PAM_SERVICE_FALLBACK "login" + #define PAM_SERVICE_FALLBACK "login" #endif #define CHECK_PAM_RET(call) \ diff --git a/src/config.c b/src/config.c index fc11b11..3c9e7ea 100644 --- a/src/config.c +++ b/src/config.c @@ -243,7 +243,7 @@ int parse_config(struct config* NNULLABLE config, char* NNULLABLE path) { if (fd == NULL) { log_perror("fopen"); log_printf(" [I] No config, place one at " LIDM_CONF_PATH - " or set the LIDM_CONF env variable"); + " or set the LIDM_CONF env variable\n"); return 0; // Its fine now anyways } diff --git a/src/log.c b/src/log.c index bd473e2..34ddc36 100644 --- a/src/log.c +++ b/src/log.c @@ -32,7 +32,7 @@ void log_perror(const char* s) { if (!logger_out) return; if (s) - (void)fprintf(logger_out, "%s: %s", s, strerror(errno)); + (void)fprintf(logger_out, "%s: %s\n", s, strerror(errno)); else - (void)fprintf(logger_out, "%s", strerror(errno)); + (void)fprintf(logger_out, "%s\n", strerror(errno)); } diff --git a/src/ui.c b/src/ui.c index a0f21c6..4bc5512 100644 --- a/src/ui.c +++ b/src/ui.c @@ -115,13 +115,13 @@ char* trunc_gethostname(const size_t MAXLEN, const char* const ELLIPSIS) { char* buf = malloc(alloc_size); if (!buf) return NULL; - if(gethostname(buf, alloc_size) != 0) { + if (gethostname(buf, alloc_size) != 0) { free(buf); return NULL; } if (utf8len(buf) > MAXLEN) { - int end = utf8trunc(buf, MAXLEN - utf8len(ELLIPSIS)); + size_t end = utf8trunc(buf, MAXLEN - utf8len(ELLIPSIS)); strcpy(&buf[end], ELLIPSIS); } return buf; diff --git a/src/util.c b/src/util.c index 0b882d4..0b730ad 100644 --- a/src/util.c +++ b/src/util.c @@ -106,12 +106,12 @@ size_t utf8len_until(const char* str, const char* until) { size_t utf8trunc(char* str, size_t n) { size_t bytes = 0; while (true) { - if(str[bytes] == '\0') break; + if (str[bytes] == '\0') break; if (utf8_iscont(str[bytes])) { bytes++; continue; } - if(n == 0) { + if (n == 0) { str[bytes] = '\0'; break; }