From e20853883a6ecd8bb3a2efbf169a77ff289c5d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Tue, 18 Jan 2022 12:17:17 +0100 Subject: [PATCH] Correct shell warnings detected by coverity --- generate-rndc-key.sh | 2 +- setup-named-chroot.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/generate-rndc-key.sh b/generate-rndc-key.sh index 956bb8e..df0604a 100755 --- a/generate-rndc-key.sh +++ b/generate-rndc-key.sh @@ -15,7 +15,7 @@ fi # This script generates /etc/rndc.key if doesn't exist AND if there is no rndc.conf -if [ ! -s /etc/rndc.key -a ! -s /etc/rndc.conf ]; then +if [ ! -s /etc/rndc.key ] && [ ! -s /etc/rndc.conf ]; then echo -n $"Generating /etc/rndc.key:" if /usr/sbin/rndc-confgen -a -A hmac-sha256 > /dev/null 2>&1 then diff --git a/setup-named-chroot.sh b/setup-named-chroot.sh index 5e68915..da82cff 100755 --- a/setup-named-chroot.sh +++ b/setup-named-chroot.sh @@ -10,7 +10,7 @@ usage() echo 'Usage: setup-named-chroot.sh ROOTDIR [chroot.files]' } -if ! [ "$#" -ge 2 -a "$#" -le 3 ]; then +if ! [ "$#" -ge 2 ] && [ "$#" -le 3 ]; then echo 'Wrong number of arguments' usage exit 1 @@ -34,9 +34,9 @@ dev_create() DEVNAME="$ROOTDIR/dev/$1" shift if ! [ -e "$DEVNAME" ]; then - /bin/mknod -m 0664 "$DEVNAME" $@ + /bin/mknod -m 0664 "$DEVNAME" "$@" /bin/chgrp named "$DEVNAME" - if [ -x /usr/sbin/selinuxenabled -a -x /sbin/restorecon ]; then + if [ -x /usr/sbin/selinuxenabled ] && [ -x /sbin/restorecon ]; then /usr/sbin/selinuxenabled && /sbin/restorecon "$DEVNAME" > /dev/null || : fi fi @@ -78,7 +78,7 @@ mount_chroot_conf() else # Mount source is a directory. Mount it only if directory in chroot is # empty. - if [ -e "$all" ] && [ `ls -1A $ROOTDIR$all | wc -l` -eq 0 ]; then + if [ -e "$all" ] && [ `ls -1A "$ROOTDIR$all" | wc -l` -eq 0 ]; then mount --bind --make-private "$all" "$ROOTDIR$all" fi fi