[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] use shorter socket constants for sockets
From: |
Eric Wong |
Subject: |
[PATCH] use shorter socket constants for sockets |
Date: |
Sun, 13 Oct 2013 02:09:04 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
This is to be compatible with Rubinius, but also works with MRI.
---
(Will file a proper bug report for rbx once I can stomach a
browser again)
lib/dtas/unix_client.rb | 2 +-
lib/dtas/unix_server.rb | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/dtas/unix_client.rb b/lib/dtas/unix_client.rb
index fa8b11c..dfde59b 100644
--- a/lib/dtas/unix_client.rb
+++ b/lib/dtas/unix_client.rb
@@ -17,7 +17,7 @@ class DTAS::UNIXClient # :nodoc:
end
def initialize(path = self.class.default_path)
- @to_io = Socket.new(:AF_UNIX, :SOCK_SEQPACKET, 0)
+ @to_io = Socket.new(:UNIX, :SEQPACKET, 0)
@to_io.connect(Socket.pack_sockaddr_un(path))
end
diff --git a/lib/dtas/unix_server.rb b/lib/dtas/unix_server.rb
index bccfad5..21261d3 100644
--- a/lib/dtas/unix_server.rb
+++ b/lib/dtas/unix_server.rb
@@ -26,13 +26,13 @@ class DTAS::UNIXServer # :nodoc:
# lock down access by default, arbitrary commands may run as the
# same user dtas-player runs as:
old_umask = File.umask(0077)
- @to_io = Socket.new(:AF_UNIX, :SOCK_SEQPACKET, 0)
+ @to_io = Socket.new(:UNIX, :SEQPACKET, 0)
addr = Socket.pack_sockaddr_un(path)
begin
@to_io.bind(addr)
rescue Errno::EADDRINUSE
# maybe we have an old path leftover from a killed process
- tmp = Socket.new(:AF_UNIX, :SOCK_SEQPACKET, 0)
+ tmp = Socket.new(:UNIX, :SEQPACKET, 0)
begin
tmp.connect(addr)
raise RuntimeError, "socket `#{path}' is in use", []
--
1.8.4.481.gf849bb6