From 641a433fad0102b22be31424464b7114cf02c38d Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Thu, 13 Sep 2007 02:53:42 +0000 Subject: [PATCH] Fix eread to not accept invalid input for file selection. (Bug #189994) svn path=/; revision=436 --- trunk/ChangeLog | 2 ++ trunk/src/eread/eread | 55 +++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/trunk/ChangeLog b/trunk/ChangeLog index 4c939be..105cdb6 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -3,6 +3,8 @@ #192345) * revdep-rebuild: Correctly handle the case where an ebuild no longer exists for a package (Bug #188918) + * eread: Fix eread to not accept invalid input for file selection. + (Bug #189994) 2007-08-08: Paul Varner * revdep-rebuild: Fix progress bar to only update when there is a diff --git a/trunk/src/eread/eread b/trunk/src/eread/eread index 2097460..c6d4de1 100755 --- a/trunk/src/eread/eread +++ b/trunk/src/eread/eread @@ -49,31 +49,36 @@ select_loop() { break ;; *) - ${PAGER} ${FILE} - read -p "Delete file? [y/N] " DELETE - case ${DELETE} in - q) - echo "Quitting" - QUIT="yes" - break - ;; - y|Y) - rm -f ${FILE} - SUCCESS=$? - if [[ ${SUCCESS} = 0 ]]; then - echo "Deleted ${FILE}" - else - echo "Unable to delete ${FILE}" - fi - ;; - # Empty string defaults to N (save file) - n|N|"") - echo "Saving ${FILE}" - ;; - *) - echo "Invalid response. Saving ${FILE}" - ;; - esac + if [ -f "$FILE" ]; then + ${PAGER} ${FILE} + read -p "Delete file? [y/N] " DELETE + case ${DELETE} in + q) + echo "Quitting" + QUIT="yes" + break + ;; + y|Y) + rm -f ${FILE} + SUCCESS=$? + if [[ ${SUCCESS} = 0 ]]; then + echo "Deleted ${FILE}" + else + echo "Unable to delete ${FILE}" + fi + ;; + # Empty string defaults to N (save file) + n|N|"") + echo "Saving ${FILE}" + ;; + *) + echo "Invalid response. Saving ${FILE}" + ;; + esac + else + echo + echo "Invalid response." + fi ;; esac break -- 2.26.2