summaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
authorsijanec <anton@sijanec.eu>2021-04-03 23:15:48 +0200
committersijanec <anton@sijanec.eu>2021-04-03 23:15:48 +0200
commitbbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4 (patch)
treef9960c7a43f7c0e1da6cb8e8656fcbda2129677a /src/log.c
parentinitial commit (diff)
downloadsear.c-bbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4.tar
sear.c-bbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4.tar.gz
sear.c-bbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4.tar.bz2
sear.c-bbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4.tar.lz
sear.c-bbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4.tar.xz
sear.c-bbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4.tar.zst
sear.c-bbf6fe2fd069ef89f73ecc3fe3ec2000833f05f4.zip
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index d229512..5e4dc16 100644
--- a/src/log.c
+++ b/src/log.c
@@ -31,7 +31,7 @@ int sc_push_log (unsigned char t, struct sc_cache * c, const char * ca, char * f
return -2;
if (pthread_rwlock_wrlock(lock))
return -3;
- if (c->logentries_sizeof - c->logentries_length != 0)
+ if (c->logentries_sizeof <= c->logentries_length)
SC_BIGGER_ARRAY(c->logentries, sc_logentry);
c->logentries_length++;
size_t strlenm = strlen(m);
@@ -53,6 +53,7 @@ int sc_push_log (unsigned char t, struct sc_cache * c, const char * ca, char * f
SC_PLL->line = l;
SC_PLL->function = ca;
SC_PLL->time = time(NULL);
+ SC_PLL->type = t;
fprintf(stderr, "[sear.c] %s %s()@%s:%lu: %s\n", sc_log_str(t), ca, f, l, SC_PLL->message); /* in posix, this is thread safe */
if (lock && pthread_rwlock_unlock(lock))
return -4;