diff --git a/include/functions b/include/functions index 87382c58..d81382d6 100644 --- a/include/functions +++ b/include/functions @@ -726,7 +726,7 @@ if [ $# -eq 0 ]; then ExitFatal "Missing parameter when calling FileIsEmpty function"; fi EMPTY=0 LogText "Test: checking if file $1 is empty" - if [ -z $1 ]; then + if [ ! -s "$1" ]; then LogText "Result: file $1 is empty" EMPTY=1 return 0 @@ -1489,7 +1489,7 @@ # Amazon EC2 if [ "${SHORT}" = "" ]; then LogText "Test: checking specific files for Amazon" - if [ -f /etc/ec2_version -a ! -z /etc/ec2_version ]; then + if [ -f /etc/ec2_version -a -s /etc/ec2_version ]; then SHORT="amazon-ec2" else LogText "Result: system not hosted on Amazon" diff --git a/include/tests_time b/include/tests_time index 05781c81..4d9dbfe5 100644 --- a/include/tests_time +++ b/include/tests_time @@ -428,7 +428,7 @@ FOUND=0 FILE="/etc/ntp/step-tickers" if [ -f ${FILE} ]; then - if [ -z ${FILE} ]; then + if [ ! -s "${FILE}" ]; then LogText "Result: ${FILE} is empty. The step-tickers contain no configured NTP servers" Display --indent 2 --text "- Checking NTP step-tickers file" --result "EMPTY FILE" --color YELLOW ReportSuggestion ${TEST_NO} "Use step-tickers file for quicker time synchronization"