fix: format and linter errors

This commit is contained in:
2025-07-16 19:04:58 +02:00
parent 4a1b868b8e
commit f1464751ae
5 changed files with 8 additions and 8 deletions

View File

@@ -36,7 +36,7 @@ int pam_conversation(int num_msg, const struct pam_message** msg,
} }
#ifndef PAM_SERVICE_FALLBACK #ifndef PAM_SERVICE_FALLBACK
#define PAM_SERVICE_FALLBACK "login" #define PAM_SERVICE_FALLBACK "login"
#endif #endif
#define CHECK_PAM_RET(call) \ #define CHECK_PAM_RET(call) \

View File

@@ -243,7 +243,7 @@ int parse_config(struct config* NNULLABLE config, char* NNULLABLE path) {
if (fd == NULL) { if (fd == NULL) {
log_perror("fopen"); log_perror("fopen");
log_printf(" [I] No config, place one at " LIDM_CONF_PATH 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 return 0; // Its fine now anyways
} }

View File

@@ -32,7 +32,7 @@ void log_perror(const char* s) {
if (!logger_out) return; if (!logger_out) return;
if (s) if (s)
(void)fprintf(logger_out, "%s: %s", s, strerror(errno)); (void)fprintf(logger_out, "%s: %s\n", s, strerror(errno));
else else
(void)fprintf(logger_out, "%s", strerror(errno)); (void)fprintf(logger_out, "%s\n", strerror(errno));
} }

View File

@@ -115,13 +115,13 @@ char* trunc_gethostname(const size_t MAXLEN, const char* const ELLIPSIS) {
char* buf = malloc(alloc_size); char* buf = malloc(alloc_size);
if (!buf) return NULL; if (!buf) return NULL;
if(gethostname(buf, alloc_size) != 0) { if (gethostname(buf, alloc_size) != 0) {
free(buf); free(buf);
return NULL; return NULL;
} }
if (utf8len(buf) > MAXLEN) { if (utf8len(buf) > MAXLEN) {
int end = utf8trunc(buf, MAXLEN - utf8len(ELLIPSIS)); size_t end = utf8trunc(buf, MAXLEN - utf8len(ELLIPSIS));
strcpy(&buf[end], ELLIPSIS); strcpy(&buf[end], ELLIPSIS);
} }
return buf; return buf;

View File

@@ -106,12 +106,12 @@ size_t utf8len_until(const char* str, const char* until) {
size_t utf8trunc(char* str, size_t n) { size_t utf8trunc(char* str, size_t n) {
size_t bytes = 0; size_t bytes = 0;
while (true) { while (true) {
if(str[bytes] == '\0') break; if (str[bytes] == '\0') break;
if (utf8_iscont(str[bytes])) { if (utf8_iscont(str[bytes])) {
bytes++; bytes++;
continue; continue;
} }
if(n == 0) { if (n == 0) {
str[bytes] = '\0'; str[bytes] = '\0';
break; break;
} }