From 835f711502fa07825b27201cb772e911c59d54b0 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 21 Jul 2021 10:10:43 +0200 Subject: [PATCH] ipsec barf: fix shell test expression Spotted by shellcheck: /usr/libexec/ipsec/barf:55:5: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks. # 53| for f # 54| do # 55|-> if [ -s ${LOGS}/${f} -a \ # 56| -f ${LOGS}/${f} -a \ # 57| grep -E -q "${s}" ${LOGS}/${f} 2>/dev/null ] Signed-off-by: Daiki Ueno --- programs/barf/barf.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/programs/barf/barf.in b/programs/barf/barf.in index e76c62f338..499916da4b 100755 --- a/programs/barf/barf.in +++ b/programs/barf/barf.in @@ -53,8 +53,8 @@ findlog() { # findlog string fallbackstring possiblefile ... for f do if [ -s ${LOGS}/${f} -a \ - -f ${LOGS}/${f} -a \ - grep -E -q "${s}" ${LOGS}/${f} 2>/dev/null ] + -f ${LOGS}/${f} ] && \ + grep -E -q "${s}" ${LOGS}/${f} 2>/dev/null then # aha, this one has it findlog_file=${LOGS}/${f} @@ -66,8 +66,8 @@ findlog() { # findlog string fallbackstring possiblefile ... for f do if [ -s ${LOGS}/${f} -a \ - -f ${LOGS}/${f} -a \ - grep -E -q "${t}" ${LOGS}/${f} 2>/dev/null ] + -f ${LOGS}/${f} ] && \ + grep -E -q "${t}" ${LOGS}/${f} 2>/dev/null then # aha, this one has it findlog_file=${LOGS}/${f} @@ -80,8 +80,8 @@ findlog() { # findlog string fallbackstring possiblefile ... for f in $(ls -t ${LOGS} | grep -E -v 'lastlog|tmp|^mail|\.(gz|Z)$') do if [ -f ${LOGS}/${f} -a \ - ! -d ${LOGS}/${f} -a \ - grep -E -q "${s}" ${LOGS}/${f} 2>/dev/null ] + ! -d ${LOGS}/${f} ] && \ + grep -E -q "${s}" ${LOGS}/${f} 2>/dev/null then # found it findlog_file=${LOGS}/${f} @@ -93,8 +93,8 @@ findlog() { # findlog string fallbackstring possiblefile ... for f in $(ls -t ${LOGS} | grep -E -v 'lastlog|tmp|^mail|\.(gz|Z)$') do if [ -s ${LOGS}/${f} -a \ - -f ${LOGS}/${f} -a \ - grep -E -q "${t}" ${LOGS}/${f} 2>/dev/null ] + -f ${LOGS}/${f} ] && \ + grep -E -q "${t}" ${LOGS}/${f} 2>/dev/null then # found it findlog_file=${LOGS}/${f} -- 2.31.1 From 00ee1189626db8dcce084cb481ad0c49b435f4ff Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 21 Jul 2021 10:54:58 +0200 Subject: [PATCH] testing jambufcheck: add missing va_end calls in error path Signed-off-by: Daiki Ueno --- testing/programs/jambufcheck/jambufcheck.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testing/programs/jambufcheck/jambufcheck.c b/testing/programs/jambufcheck/jambufcheck.c index 72baaa5a1d..23a47b15f6 100644 --- a/testing/programs/jambufcheck/jambufcheck.c +++ b/testing/programs/jambufcheck/jambufcheck.c @@ -104,11 +104,13 @@ static void check_jambuf(bool ok, const char *expect, ...) } break; default: + va_end(ap); FAIL("bad case"); return; } } if (ok && !jambuf_ok(&buf)) { + va_end(ap); FAIL("unexpectedly failed writing '%s'", str == NULL ? "(null)" : str); return; -- 2.31.1