Module Name:    src
Committed By:   mlelstv
Date:           Sat Feb 18 07:51:52 UTC 2023

Modified Files:
        src/etc/rc.d: iscsid_volumes

Log Message:
Handle missing auth file.
Skip empty lines.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/iscsid_volumes

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/iscsid_volumes
diff -u src/etc/rc.d/iscsid_volumes:1.2 src/etc/rc.d/iscsid_volumes:1.3
--- src/etc/rc.d/iscsid_volumes:1.2	Mon Feb  6 11:53:03 2023
+++ src/etc/rc.d/iscsid_volumes	Sat Feb 18 07:51:52 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: iscsid_volumes,v 1.2 2023/02/06 11:53:03 martin Exp $
+# $NetBSD: iscsid_volumes,v 1.3 2023/02/18 07:51:52 mlelstv Exp $
 #
 
 # PROVIDE: iscsid_volumes
@@ -20,7 +20,7 @@ iscsid_volumes_start()
 
 	while read host target digest auth user alias; do
 		case $host in
-		\#*) ;;
+		\#*|"") ;;
 		*)
 			topts=''
 			case $digest in
@@ -33,13 +33,15 @@ iscsid_volumes_start()
 			pass="-"
 			mpass="-"
 
-			while read entry dummy; do
-				case $entry in
-				\#*) ;;
-				"$user":*) pass=${entry#*:} ;;
-				"$target":*) mpass=${entry#*:} ;;
-				esac
-			done < /etc/iscsi/auths
+			if [ -f /etc/iscsi/auths ]; then
+				while read entry dummy; do
+					case $entry in
+					\#*|"") ;;
+					"$user":*) pass=${entry#*:} ;;
+					"$target":*) mpass=${entry#*:} ;;
+					esac
+				done < /etc/iscsi/auths
+			fi
 
 			case $host in
 			*:*)
@@ -82,7 +84,7 @@ iscsid_volumes_stop()
 
 	while read host target digest auth user alias; do
 		case $host in
-		\#*) ;;
+		\#*|"") ;;
 		*)
 			echo "Remove target ${alias:-$target}"
 

Reply via email to