diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de52e8c1..e6fa09a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,8 @@ jobs: run: | ./configure --prefix=/usr --exec-prefix= --sysconfdir=/etc --localstatedir=/var \ --enable-x11-common-plugin --enable-testserv-plugin --with-watchdog \ - --with-keventd + --with-keventd \ + CFLAGS="-fsanitize=address -ggdb" make -j3 clean make -j3 V=1 - name: Install to /tmp diff --git a/check.sh b/check.sh index 9b153629..56c32bb2 100755 --- a/check.sh +++ b/check.sh @@ -3,5 +3,6 @@ make distclean ./configure --prefix=/usr --exec-prefix= --sysconfdir=/etc --localstatedir=/var \ - --enable-x11-common-plugin --with-watchdog --with-keventd + --enable-x11-common-plugin --with-watchdog --with-keventd \ + CFLAGS='-fsanitize=address -ggdb' make -j17 clean check diff --git a/configure.ac b/configure.ac index b5e9bbe2..5e591fd1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Finit], [4.12], [https://github.com/troglobit/finit/issues], +AC_INIT([Finit], [4.13-pre], [https://github.com/troglobit/finit/issues], [finit], [https://troglobit.com/projects/finit/]) AC_CONFIG_AUX_DIR(aux) AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects]) diff --git a/src/initctl.c b/src/initctl.c index 726fdaa9..d1698fc4 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -767,27 +767,25 @@ static int plugins_list(char *arg) */ char *runlevel_string(int currlevel, int levels) { - static char lvl[21]; + static char lvl[32]; int i = INIT_LEVEL; - int pos = 1; - memset(lvl, 0, sizeof(lvl)); - lvl[0] = '['; + strlcpy(lvl, "[", sizeof(lvl)); do { if (ISSET(levels, i)) { - if (!plain && currlevel == i) - pos = strlcat(lvl, "\e[1m", sizeof(lvl)); - - if (i == INIT_LEVEL) - lvl[pos++] = 'S'; - else - lvl[pos++] = '0' + i; + char l[2] = { '0' + i, 0 }; if (!plain && currlevel == i) - pos = strlcat(lvl, "\e[0m", sizeof(lvl)); + strlcat(lvl, "\e[1m", sizeof(lvl)); + + strlcat(lvl, i == INIT_LEVEL ? "S" : l, sizeof(lvl)); + + + if (!plain && currlevel == i) + strlcat(lvl, "\e[0m", sizeof(lvl)); } else { - lvl[pos++] = '-'; + strlcat(lvl, "-", sizeof(lvl)); } /* XXX: ugly hack to get order right: S0123456789 */ @@ -798,8 +796,7 @@ char *runlevel_string(int currlevel, int levels) } while (i < INIT_LEVEL); - lvl[pos++] = ']'; - lvl[pos] = 0; + strlcat(lvl, "]", sizeof(lvl)); return lvl; }