This is a (very) minor optimisation. There is no semantical change as
the fixed list of possible filenames doesn't contain anything that has a
different meaning when interpreted as a regex, still I consider it
better style to interpret the filename as a fixed string to match.

Both busybox and the "big" grep support -F unconditionally so there is
no problem in using -F.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
 projectroot/etc/rc.once.d/openssh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/projectroot/etc/rc.once.d/openssh 
b/projectroot/etc/rc.once.d/openssh
index bfec7064181a..66cfa06df12a 100644
--- a/projectroot/etc/rc.once.d/openssh
+++ b/projectroot/etc/rc.once.d/openssh
@@ -26,7 +26,7 @@ create_key() {
 
        file="/etc/ssh/ssh_host_${keytype}_key"
 
-       if echo "$hostkeys" | grep -x "$file" >/dev/null; then
+       if echo "$hostkeys" | grep -x -F "$file" >/dev/null; then
                echo "Create $prettykeytype key; this may take some time ..."
                rm -f $file &&
                ssh-keygen -q -f "$file" -N '' -t "$keytype" "$@" || return
-- 
2.28.0


_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to 
[email protected]

Reply via email to