Eric Wong wrote:
Interesting nobody found this bug earlier (I think pointing logs
to /dev/null is bad :)
Generally agree. Sometimes it happens. :|
How about this, instead?  This will work in case some weirdo setups
use a non-standard path for /dev/null, and also allows logging to
FIFOs (e.g. cronolog users).

diff --git a/lib/unicorn/util.rb b/lib/unicorn/util.rb
index cde2563..f84241c 100644
--- a/lib/unicorn/util.rb
+++ b/lib/unicorn/util.rb
@@ -7,6 +7,7 @@ def self.is_log?(fp)
      append_flags = File::WRONLY | File::APPEND

      ! fp.closed?&&
+      fp.stat.file?&&
        fp.sync&&
        (fp.fcntl(Fcntl::F_GETFL)&  append_flags) == append_flags
      rescue IOError, Errno::EBADF
This looks much better as a general solution to the problem. +1 Thanks, Eric!
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to