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 2/4] desktop.eclass: domenu, fix potential overflow in exit status
Date: Thu, 26 Jul 2018 11:36:38
Message-Id: 20180726113553.1387-2-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 While increasing exit status for each failure may seem brilliant
2 at first, it serves no purpose and has an overflow risk. For example,
3 if domenu counted 256 failures, the exit status would be truncated to 0
4 (success).
5 ---
6 eclass/desktop.eclass | 4 ++--
7 1 file changed, 2 insertions(+), 2 deletions(-)
8
9 diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
10 index 1684a21d21f7..8f2c6d55c293 100644
11 --- a/eclass/desktop.eclass
12 +++ b/eclass/desktop.eclass
13 @@ -251,11 +251,11 @@ domenu() {
14 if [[ -d ${i} ]] ; then
15 for j in "${i}"/*.desktop ; do
16 doins "${j}"
17 - ((ret+=$?))
18 + ((ret|=$?))
19 done
20 else
21 doins "${i}"
22 - ((ret+=$?))
23 + ((ret|=$?))
24 fi
25 done
26 exit ${ret}
27 --
28 2.18.0