[Pm-utils] [PATCH 05/17] Minor correctness updates

Victor Lowther victor.lowther at gmail.com
Sat Feb 9 18:31:09 PST 2008


Mostly quotation fixes and the like.
---
 pm/functions.in |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/pm/functions.in b/pm/functions.in
index df632c8..74fd0c5 100644
--- a/pm/functions.in
+++ b/pm/functions.in
@@ -118,7 +118,7 @@ find_hooks() {
 	local phooks="${PM_UTILS_LIBDIR}/$1.d"
 	local base
 
-	for base in $(for f in $syshooks/*[!~] $phooks/*[!~];
+	for base in $(for f in "$syshooks/"*[!~] "$phooks/"*[!~];
 		do [ -O "$f" ] && echo ${f##*/} ; done | sort | uniq) ;
 	do
 		if [ -x "$syshooks/$base" ]; then
@@ -214,7 +214,7 @@ pm_main()
 }
 
 _rmmod() {
-	if modprobe -r $1; then
+	if modprobe -r "$1"; then
 		touch "${STORAGEDIR}/module:$1"
 		return 0
 	else
@@ -239,7 +239,7 @@ modunload()
 		else
 			# modules depend on this one.  try to remove them first.
 			MODS="${USED%%*,}"
-			while [ "${MODS}" ]; do
+			while [ -n "${MODS}" ]; do
 				# try to unload the last one first
 				MOD="${MODS##*,}"
 				modunload $MOD && RET=0
@@ -261,7 +261,7 @@ modunload()
 # reload all the modules in no particular order.
 modreload()
 {
-	for x in ${STORAGEDIR}/module:* ; do
+	for x in "${STORAGEDIR}"/module:* ; do
 		[ -O "${x}" ] && modprobe "${x##*:}" >/dev/null 2>&1
 	done
 }
@@ -269,7 +269,9 @@ modreload()
 if ! command_exists service; then
 	service() {
 		if [ -x "/etc/init.d/$1" ]; then
-			"/etc/init.d/$@"
+			svc="$1"
+			shift
+			"/etc/init.d/$svc" "$@"
 		else
 			echo "$1" $": unrecognized service" 1>&2
 			return 1
-- 
1.5.3.8



More information about the Pm-utils mailing list