about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2012-04-25 09:12:58 +0000
committerMikael Magnusson <mikachu@gmail.com>2012-04-25 09:12:58 +0000
commit8afbb0096204f61561b99726992969858b9d0f30 (patch)
tree49c198777007b612ad52df5bc621e780f7c9c5ea
parente49e41725abbd851e501855c4139b4826093ba0d (diff)
downloadzsh-8afbb0096204f61561b99726992969858b9d0f30.tar.gz
zsh-8afbb0096204f61561b99726992969858b9d0f30.tar.xz
zsh-8afbb0096204f61561b99726992969858b9d0f30.zip
30429: avoid error in _init_d when service doesn't exist
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Unix/Command/_init_d1
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c23237baa..68f9922a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-25  Mikael Magnusson  <mikachu@gmail.com>
+
+	* 30429: Completion/Unix/Command/_init_d: Avoid error when the
+	service doesn't exist.
+
 2012-04-22  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* unposted: Src/subst.c: add test for valid identifier to 30431.
@@ -16237,5 +16242,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5639 $
+* $Revision: 1.5640 $
 *****************************************************
diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d
index dd9933a46..bbf62fc0d 100644
--- a/Completion/Unix/Command/_init_d
+++ b/Completion/Unix/Command/_init_d
@@ -68,6 +68,7 @@ else
 
     what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
 
+    [[ -x $script ]] || return 1
     read -u0 -k2 magic < $script && [[ $magic = '#!' ]] &&
     cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} )