Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 4/4] desktop.eclass: Add missing ||die when writing to files
Date: Thu, 26 Jul 2018 11:37:48
Message-Id: 20180726113553.1387-4-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/4] desktop.eclass: domenu, fix dying on non-existing files by "Michał Górny"
1 ---
2 eclass/desktop.eclass | 8 +++++---
3 1 file changed, 5 insertions(+), 3 deletions(-)
4
5 diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
6 index 08899b4a4607..6fc72ab8ec03 100644
7 --- a/eclass/desktop.eclass
8 +++ b/eclass/desktop.eclass
9 @@ -174,7 +174,7 @@ make_desktop_entry() {
10 icon=${icon%.*}
11 fi
12
13 - cat <<-EOF > "${desktop}"
14 + cat <<-EOF > "${desktop}" || die
15 [Desktop Entry]
16 Name=${name}
17 Type=Application
18 @@ -190,7 +190,9 @@ make_desktop_entry() {
19 ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}"
20 fields="Path=${fields}"
21 fi
22 - [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}"
23 + if [[ -n ${fields} ]]; then
24 + printf '%b\n' "${fields}" >> "${desktop}" || die
25 + fi
26
27 (
28 # wrap the env here so that the 'insinto' call
29 @@ -217,7 +219,7 @@ make_session_desktop() {
30 local desktop=${T}/${wm:-${PN}}.desktop
31 shift 2
32
33 - cat <<-EOF > "${desktop}"
34 + cat <<-EOF > "${desktop}" || die
35 [Desktop Entry]
36 Name=${title}
37 Comment=This session logs you into ${title}
38 --
39 2.18.0