From 971e83d17061d018822181d7ce7353f818b8fe7f Mon Sep 17 00:00:00 2001 From: Ivan Rako Date: Mon, 6 Jun 2005 10:00:22 +0000 Subject: [PATCH] r67: modifikacija cp_check_and_sed funkcije ako pukne sed, funkcija se nastavi i pregazi fajl, odnosno fajl ostane prazan. --- functions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions.sh b/functions.sh index cc892b7..85e9dd9 100644 --- a/functions.sh +++ b/functions.sh @@ -182,6 +182,7 @@ cp_backup_conffile() { } # by jelly, Tue, 15 Mar 2005 14:04:21 +0100 +# modified by ico, Mon, 6 Jun 2005 11:58:08 +0200 # A sed wrapper, to use instead of perl -pi -e # - relatively safe in-place s///g # - takes care of symlinks and ownership @@ -204,6 +205,11 @@ cp_check_and_sed() { fi [ -h "$i" ] && i=$(readlink -f "$i") sed "$sedcmd" "$i" > "$i.dpkg-tmp" + if [ ! "$?" = "0" ]; then + rm "$i.dpkg-tmp" + echo "cp_check_and_sed: Problem with sed" 1>&2 + return 5 + fi if ! cmp -s "$i" "$i.dpkg-tmp" 2>&1 >/dev/null; then cp_mv "$i.dpkg-tmp" "$i" else @@ -276,6 +282,7 @@ cp_mv () { fi mv "$new" "$old" } + # by ddzeko, Mon, 21 Mar 2005 13:35:42 +0100 cp_yes_no () { [ "$CP_SCRIPT_DEBUG" ] && set -vx -- 1.7.10.4