Petr Šabata 81d24c
From 22bfdcf060b632b5a6ff603f8f42ff166c211a66 Mon Sep 17 00:00:00 2001
Petr Šabata 81d24c
From: Jakub Jelen <jjelen@redhat.com>
Petr Šabata 81d24c
Date: Tue, 29 Sep 2020 10:02:45 +0000
Petr Šabata 81d24c
Subject: [PATCH] Fail hard on the first failed attempt to write the
Petr Šabata 81d24c
 authorized_keys_file
Petr Šabata 81d24c
Petr Šabata 81d24c
---
Petr Šabata 81d24c
 ssh-copy-id | 2 +-
Petr Šabata 81d24c
 1 file changed, 1 insertion(+), 1 deletion(-)
Petr Šabata 81d24c
Petr Šabata 81d24c
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
Petr Šabata 81d24c
index 392f64f..e69a23f 100755
Petr Šabata 81d24c
--- a/contrib/ssh-copy-id
Petr Šabata 81d24c
+++ b/contrib/ssh-copy-id
Petr Šabata 81d24c
@@ -251,7 +251,7 @@ installkeys_sh() {
Petr Šabata 81d24c
 	cd;
Petr Šabata 81d24c
 	umask 077;
Petr Šabata 81d24c
 	mkdir -p $(dirname "${AUTH_KEY_FILE}") &&
Petr Šabata 81d24c
-	  { [ -z \`tail -1c ${AUTH_KEY_FILE} 2>/dev/null\` ] || echo >> ${AUTH_KEY_FILE}; } &&
Petr Šabata 81d24c
+	  { [ -z \`tail -1c ${AUTH_KEY_FILE} 2>/dev/null\` ] || echo >> ${AUTH_KEY_FILE} || exit 1; } &&
Petr Šabata 81d24c
 	  cat >> ${AUTH_KEY_FILE} ||
Petr Šabata 81d24c
 	  exit 1;
Petr Šabata 81d24c
 	if type restorecon >/dev/null 2>&1; then
Petr Šabata 81d24c
-- 
Petr Šabata 81d24c
GitLab
Petr Šabata 81d24c
Petr Šabata 81d24c