From: Eric Wong <e@80x24.org>
To: unicorn-public@bogomips.org
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH 1/3] golf down conditional for socket activation
Date: Sun, 1 Nov 2015 08:37:45 +0000 [thread overview]
Message-ID: <20151101083747.23877-2-e@80x24.org> (raw)
In-Reply-To: <20151101083747.23877-1-e@80x24.org>
The PID of a process can never be zero as kill(2) interprets a '0'
PID arg as "every process in caller's process group", so there's no
risk of the 'nil.to_i => 0' conversion resulting in a truth value
when compared to $$.
---
lib/unicorn/http_server.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index c1a2e60..ca56ed3 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -770,7 +770,7 @@ class Unicorn::HttpServer
# emulate sd_listen_fds() for systemd
sd_pid, sd_fds = ENV.values_at('LISTEN_PID', 'LISTEN_FDS')
- if sd_pid && sd_pid.to_i == $$
+ if sd_pid.to_i == $$ # n.b. $$ can never be zero
# 3 = SD_LISTEN_FDS_START
inherited.concat((3...(3 + sd_fds.to_i)).to_a)
end
--
EW
next prev parent reply other threads:[~2015-11-01 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-01 8:37 [PATCH 0/3] last updates before 5.0 release Eric Wong
2015-11-01 8:37 ` Eric Wong [this message]
2015-11-01 8:37 ` [PATCH 2/3] gemspec: relax Ruby version requirement for old RubyGems Eric Wong
2015-11-01 8:37 ` [PATCH 3/3] doc updates Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151101083747.23877-2-e@80x24.org \
--to=e@80x24.org \
--cc=unicorn-public@bogomips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).