[arch-projects] [initscripts] [PATCH 07/11] functions: Simplify ck_autostart() by refactoring using in_array()
Kurt J. Bosch
kjb-temp-2009 at alpenjodel.de
Sat Jul 2 15:40:50 EDT 2011
Dave Reisner, 2011-07-02 21:09:
> On Sat, Jul 02, 2011 at 08:44:25PM +0200, Kurt J. Bosch wrote:
>> ---
>> functions | 6 +-----
>> 1 files changed, 1 insertions(+), 5 deletions(-)
>>
>> diff --git a/functions b/functions
>> index 11f8317..a8ef211 100644
>> --- a/functions
>> +++ b/functions
>> @@ -198,11 +198,7 @@ have_daemon() {
>>
>> # Check if $1 is started at boot
>> ck_autostart() {
>> - local d
>> - for d in "${DAEMONS[@]}"; do
>> - [[ "$1" = ${d#@} ]]&& return 1
>> - done
>> - return 0
>> + in_array "$1" "${DAEMONS[@]}"&& return 1 || return 0
>
> This isn't the same. You've completely ignored any daemon started in the
> background. You could naively trim the DAEMONS list:
>
> in_array "$1" "${DAEMONS[@]#@}"
>
> The return isn't necessary -- its implicitly provided by the return of
> in_array.
>
> dave
NACK
http://projects.archlinux.org/initscripts.git/tree/functions#n167
>
>> }
>>
>> start_daemon() {
>> --
>> 1.7.1
>>
--
Kurt
More information about the arch-projects
mailing list