summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-12 04:02:41 +0200
committerDave Reisner <dreisner@archlinux.org>2011-09-27 12:18:04 +0200
commitcc36db45aecb3c39cb5368c3cf2a1203a18daba7 (patch)
tree8e6adb1081c2a757e06979294126e89acd64217f /functions
parent84226d26c065b3c1eb6f2dcf551f416d284278d5 (diff)
downloadmkinitcpio-cc36db45aecb3c39cb5368c3cf2a1203a18daba7.tar.gz
mkinitcpio-cc36db45aecb3c39cb5368c3cf2a1203a18daba7.tar.xz
ensure local scoping of variables
Also make sure that simple variables are declared as null strings. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'functions')
-rw-r--r--functions12
1 files changed, 9 insertions, 3 deletions
diff --git a/functions b/functions
index 8eef5b8..eb1bf01 100644
--- a/functions
+++ b/functions
@@ -115,6 +115,8 @@ _add_symlink() {
auto_modules() {
# Perform auto detection of modules via sysfs.
+ local mods=
+
IFS=$'\n' read -rd '' -a mods < \
<(find /sys/devices -name modalias -exec sort -u {} + |
# delimit each input by a newline, expanded in place
@@ -130,6 +132,8 @@ all_modules() {
# $@: filter arguments to grep
local -i count=0
+ local mod=
+
while read -r -d '' mod; do
(( ++count ))
mod=${mod##*/}
@@ -158,7 +162,7 @@ add_module() {
# discovered and added.
# $1: module name
- local module path dep deps field value
+ local module= path= dep= deps= field= value=
local -i ign_errors=0
if [[ $1 = -@(t|-try) ]]; then
@@ -214,6 +218,8 @@ add_full_dir() {
# No parsing is performed and the contents of the directory is added as is.
# $1: path to directory
+ local f=
+
if [[ -n $1 && -d $1 ]]; then
for f in "$1"/*; do
if [[ -d "$f" ]]; then
@@ -278,7 +284,7 @@ add_binary() {
# $2: destination on initcpio (optional, defaults to same as source)
local -a sodeps
- local regex binary dest mode sodep resolved dirname
+ local line= regex= binary= dest= mode= sodep= resolved= dirname=
if [[ ${1:0:1} != '/' ]]; then
binary=$(pathlookup "$1")
@@ -322,7 +328,7 @@ parse_hook() {
# prior to the start of hook processing, and after each hook's build
# function is run.
- local item
+ local item=
for item in $MODULES; do
if [[ ${item:(-1)} = '?' ]]; then