commit:     0e65a9e6769cbcd3f59cd5facb15ac03983f4859
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 20 21:23:47 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 21 15:47:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=0e65a9e6

gen_funcs.sh: dump_debugcache(): Echo DEBUGCACHE when $LOGFILE isn't writable

This can happen until determine_real_args() was called.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_funcs.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gen_funcs.sh b/gen_funcs.sh
index de8cd7f..0277eb2 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -44,7 +44,15 @@ set_color_vars
 
 dump_debugcache() {
        TODEBUGCACHE=no
-       echo "${DEBUGCACHE}" >> "${LOGFILE}"
+
+       if [ -w "${LOGFILE}" ]
+       then
+               echo "${DEBUGCACHE}" >> "${LOGFILE}"
+       else
+               echo "WARNING: Cannot write to '${LOGFILE}'!"
+               echo "${DEBUGCACHE}"
+       fi
+
        DEBUGCACHE=
 }
 

Reply via email to