[CRIU] [PATCH 1/2] scripts: detect EOF on read in a usual way in systemd-autofs-restart.sh

Eugene Kolomeetz klm at virtuozzo.com
Tue Jun 7 08:06:04 PDT 2016


When read bultin detects EOF, it sets empty string as value of specified
variable, and returns non-zero exit code. So we can rely just on exit
code, and not check variable value. This is standard approach.
https://jira.sw.ru/browse/PSBM-44207

Signed-off-by: Eugene Kolomeetz <klm at virtuozzo.com>
---
 scripts/systemd-autofs-restart.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/systemd-autofs-restart.sh b/scripts/systemd-autofs-restart.sh
index 6ef2261..57d21a5 100755
--- a/scripts/systemd-autofs-restart.sh
+++ b/scripts/systemd-autofs-restart.sh
@@ -60,7 +60,7 @@ function check_fs_type {
 	local top_mount_id=""
 	local top_mount_fs_type=""
 
-	while IFS='' read -r line || [[ -n "$line" ]]; do
+	while IFS='' read -r line; do
 		# Skip those entries which do not match the mountpoint
 		[ "$(echo $line | awk '{print $5;}')" = "$mountpoint" ] || continue
 
-- 
1.7.6



More information about the CRIU mailing list