diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-08 04:13:23 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-08 04:13:23 +0000 |
commit | d85fae1a653e6dcea343347cead2effd5a859cae (patch) | |
tree | 772cebf74f5fe8cfbe54da1735eff33aa01d26ca | |
parent | 9f13269062094853b023d09b4ac24d2cf08a0de2 (diff) |
getpidfile was not working at all. Fix it to work as intended.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6261 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | .inspircd.inc | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/.inspircd.inc b/.inspircd.inc index 71eb3a754..149eb04a6 100644 --- a/.inspircd.inc +++ b/.inspircd.inc @@ -223,25 +223,24 @@ sub getpidfile { # Close the file close INFILE; - # Clean up the file, no newlines etc.. + # remove trailing spaces chomp(@lines); foreach $i (@lines) { + # clean it up $i =~ s/[^=]+=\s(.*)/\1/; - } - my $tmp = join("",@lines); - - # Does this file have a pid? - if (($tmp =~ /<pid file=\"(\S+)\">/i) && ($tmp !~ /^#/)) - { - # Set the PID file and return. - $pidfile = $1; - return; + # Does this file have a pid? + if (($i =~ /<pid file=\"(\S+)\">/i) && ($i !~ /^#/)) + { + # Set the PID file and return. + $pidfile = $1; + return; + } } - # If we get here, NO PID FILE! -- Check for includes (Seeing as we will eventually return, - # The while (1) is safe.) - while (1) { - if (($tmp =~ s/\<include file=\"(.+?)\"\>//i) && ($tmp !~ /^#/)) + # If we get here, NO PID FILE! -- Check for includes + foreach $i (@lines) { + $i =~ s/[^=]+=\s(.*)/\1/; + if (($i =~ s/\<include file=\"(.+?)\"\>//i) && ($i !~ /^#/)) { # Decend into that file, and check for PIDs.. (that sounds like an STD ;/) getpidfile($1); @@ -250,12 +249,11 @@ sub getpidfile { # Yes, Return. return; } - } else { - # End of includes / No includes found. - $pidfile = $confpath . "inspircd.pid"; - return; } } + + # End of includes / No includes found. Using default. + $pidfile = $confpath . "inspircd.pid"; } sub getstatus { |